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).

!7

static BufferedImage img;
static MouseMover mover;
static ExternalAI findVolumeIcon, findAudioMixer;

static int w = 400, h = 200;

p {
  findVolumeIcon = loadWinnerAI(#1007093);
  findAudioMixer = loadWinnerAI(#1007103);
  
  mover = new MouseMover().enable();
  try {
    if (!step2()) {
      if (!step1()) fail("no volume icon");
      long time = sysNow();
      while (!step2()) {
        if (mover.hasInterference()) ret;
        if (sysNow() >= time+5000) fail("timeout, no popup found");
      }
      print("Done, audio mixer should pop up");
    }
  } finally {
    mover.disable();
  }
}

sbool step1() {
  ret findAndClick(findVolumeIcon);
}

sbool step2() {
  ret findAndClick(findAudioMixer);
}

sbool findAndClick(ExternalAI ai) {
  img = shootBottomRightCorner2(w, h);
  Pt p = ai.call(img);
  if (p == null) false;
  mover.click(p.x+screenWidth()-img.getWidth(), p.y+screenHeight()-img.getHeight());
  true;
}

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: 478 / 617
Version history: 10 change(s)
Referenced in: