How to use Automator to bring a window to the fore?

I am using a Mac, OSX 10.6, and I have a feature in a desktop application that I want to automate. Manually, I press Command + R, waiting for the application to read some data from the physical device for 1 minute, then press + R again to do another reading (at this point it asks me if I want to save the data, so I click tab, tab, and then a space bar to choose to save data.I do it 3 times, so I want to automate 3 times, so I can get away from the computer and it will read 3 times automatically.

Is an automatic machine the best way to do this?

I tried to do this already in the machine using the "watch me do" function. It starts with โ€œbring theโ€œ Untitled to the foreground โ€window, and then the second command - press the + R command. Then I found a small piece of apple script to wait 1 minute and I will connect the first action to this for the wait function.

However, when I press run or step, instead of moving and opening the correct window ("Untitled"), the cursor moves to the Media button in the machine and instead clicks! But the application is definitely indicated as correct.

Any help is appreciated, but maybe an automaton is the wrong way?

+4
source share
2 answers

Apple Script is the best way to go for something that does not require any "special processing" to be performed by a chain of different applications.

1) The utility of the AppleScript utility, make sure that you are using GUI scripts in the "AppleScript Utility", 2) using the Script editor, select "File"> "Open Library" and see if your application has any functions available for scripting ... this may be the best way.

3) Create a new Script and paste something like this ...

tell application "Firefox" activate delay 1 -- give it time to react repeat 3 times -- this gives us the keyboard tell application "System Events" keystroke "r" using {command down} end tell delay 6 end repeat end tell 

I used Firefox to check it .... should work for you ....

Once you get the Script, you can use the save to add it to the application or save it as a Script in your ~ / Library / Scripts folder or paste it into the machine workflow and schedule it with iCal.

+3
source

I donโ€™t think that an automaton is the way to go. You can use applescript, but you should take a look at sikuli . You will need to write a Sikuli script yourself, but what you describe should not be difficult.

+1
source

Source: https://habr.com/ru/post/1301282/


All Articles