Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

42
LINES

< > BotCompany Repo | #1005792 // Try to open Windows start menu

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (2431L/16K/53K).

1  
!752
2  
3  
static int menuState() {
4  
  ret checkBottomLeftCorner("#1005785 #1005786 #1005790");
5  
}
6  
7  
static int checkBottomLeftCorner(S imageIDs) {
8  
  int i = 1;
9  
  for (S imageID : splitAtSpace(imageIDs)) {
10  
    if (bottomLeftCornerIs(imageID))
11  
      ret i;
12  
    ++i;
13  
  }
14  
  ret 0;
15  
}
16  
17  
p {
18  
  openStartMenu();
19  
}
20  
21  
svoid openStartMenu {
22  
  BufferedImage img = loadImage2("#1005785");
23  
  int state = menuState();
24  
  if (state == 0) fail("Where is the start menu!?");
25  
  if (state != 3) {
26  
    int x = img.getWidth()/2, y = screenHeight()-img.getHeight()/2;
27  
    if (state == 1) {
28  
      moveMouseTo(x, y);
29  
      sleepSeconds(0.2);
30  
      state = menuState();
31  
    }
32  
    if (state != 2) fail("Can't open start menu!");
33  
    mouseClick(x, y);
34  
    long timeout = now() + 3000;
35  
    while (state != 3 && now() < timeout) {
36  
      sleepSeconds(0.1);
37  
      state = menuState();
38  
    }
39  
    if (state != 3) fail("Bohoo, start menu doesn't open");
40  
  }
41  
  print("Start menu should be open!! :-))");
42  
}

Author comment

Began life as a copy of #1005789

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005792
Snippet name: Try to open Windows start menu
Eternal ID of this version: #1005792/1
Text MD5: 8e03cc2c53ba8b7f0b5349401764d893
Transpilation MD5: ff992d08ba6a48150e5c3964f3838c96
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-09 02:09:40
Source code size: 1000 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 398 / 489
Referenced in: [show references]