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

43
LINES

< > BotCompany Repo | #1007108 // Automation, Linux: Open Audio Mixer [dev.]

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

Libraryless. Click here for Pure Java version (5165L/36K/118K).

1  
!7
2  
3  
static BufferedImage img;
4  
static MouseMover mover;
5  
static ExternalAI findVolumeIcon, findAudioMixer;
6  
7  
static int w = 400, h = 200;
8  
9  
p {
10  
  findVolumeIcon = loadWinnerAI(#1007093);
11  
  findAudioMixer = loadWinnerAI(#1007103);
12  
  
13  
  mover = new MouseMover().enable();
14  
  try {
15  
    if (!step2()) {
16  
      if (!step1()) fail("no volume icon");
17  
      long time = sysNow();
18  
      while (!step2()) {
19  
        if (mover.hasInterference()) ret;
20  
        if (sysNow() >= time+5000) fail("timeout, no popup found");
21  
      }
22  
      print("Done, audio mixer should pop up");
23  
    }
24  
  } finally {
25  
    mover.disable();
26  
  }
27  
}
28  
29  
sbool step1() {
30  
  ret findAndClick(findVolumeIcon);
31  
}
32  
33  
sbool step2() {
34  
  ret findAndClick(findAudioMixer);
35  
}
36  
37  
sbool findAndClick(ExternalAI ai) {
38  
  img = shootBottomRightCorner2(w, h);
39  
  Pt p = ai.call(img);
40  
  if (p == null) false;
41  
  mover.click(p.x+screenWidth()-img.getWidth(), p.y+screenHeight()-img.getHeight());
42  
  true;
43  
}

Author comment

Began life as a copy of #1006910

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007108
Snippet name: Automation, Linux: Open Audio Mixer [dev.]
Eternal ID of this version: #1007108/11
Text MD5: 6b478dd00d13113d1f15ea4d8c14c8cc
Transpilation MD5: c42e4a2880ca925266c7462ab53355ca
Author: stefan
Category: javax / automation
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-03 02:22:47
Source code size: 975 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 617
Version history: 10 change(s)
Referenced in: [show references]