tags:

views:

378

answers:

2

I'm using a Mac, OSX 10.6 and I have a function in a desktop application that I want to automate. Manually I press Command+R wait for the application to read some data form a physical device for 1 minute, then press command+R again to take another reading (at this point it asks me if I want to save the data, so I press tab, tab and then space bar to select to save the data. I do this 3 times in total, so I want to automate the 3 times, so I can walk away from the computer and it will read 3 times automatically.

Is automator the best way to do this?

I've tried to do this already in automator by using the 'watch me do' function. This starts with the 'bring window Untitled to the front', and then the second command is press command+R. I then found a little piece of apple script to wait 1 minute and I plug the first action into that for the wait function.

However, when I click run or step, instead of going and opening up the correct window ("Untitled"), the cursor moves to the Media button in automator, and clicks that instead! But the application is definitely listed as the correct one.

Any help appreciated, but maybe automator is the wrong way to go?

+1  A: 

I don't think automator is the way to go. You could use applescript, but you should take a look at sikuli. You will need to write the Sikuli script yourself, but what you describe shouldn't be difficult

Sikuli is also great btw, thanks :)
John
+1  A: 

Apple Script is the best way to go for things that don't require any "special processing" that would need to be done by a chain of different applications.

1) uging the AppleScript Utility make sure that you have GUI scripting enabled in the "AppleScript Utility" 2) using the Script Editor choose File>Open Library and see if your application has any scriptable functions ... these may be a better way to go.

3) Create a new script and put in 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 test it .... should work for you ....

Once you've got the script you can use the save as to make it into an app or save it as a script in your ~/Library/Scripts folder or paste it into an automator workflow and schedule it with iCal.

Andrew Neelands
(make sure to change the "delay" values to the number of seconds to wait ... and change "Firefox" to your app's name)
Andrew Neelands