!752 static int menuState() { ret checkBottomLeftCorner("#1005785 #1005786 #1005790"); } static int checkBottomLeftCorner(S imageIDs) { int i = 1; for (S imageID : splitAtSpace(imageIDs)) { if (bottomLeftCornerIs(imageID)) ret i; ++i; } ret 0; } p { openStartMenu(); } svoid openStartMenu { BufferedImage img = loadImage2("#1005785"); int state = menuState(); if (state == 0) fail("Where is the start menu!?"); if (state != 3) { int x = img.getWidth()/2, y = screenHeight()-img.getHeight()/2; if (state == 1) { moveMouseTo(x, y); sleepSeconds(0.2); state = menuState(); } if (state != 2) fail("Can't open start menu!"); mouseClick(x, y); long timeout = now() + 3000; while (state != 3 && now() < timeout) { sleepSeconds(0.1); state = menuState(); } if (state != 3) fail("Bohoo, start menu doesn't open"); } print("Start menu should be open!! :-))"); }