views:

297

answers:

1

Since recently Apple changed the iTunes Connect interface, and people are required to upload apps with the Application Loader.

That's nice but I need a script for automating my work.

How can an app like App Loader be automated?

I was thinking of something written in AppleScript ... but I don't know what actions it exposes (if any). Found somewhere that I could also do GUI scripting from within AppleScript, but I can't find docs on that.

What I need ... some way to trigger input actions (mouse clicks / keyboard input) and read the text from the various controls displayed.

If that would be possible in Python/Ruby it would be great, but AppleScript is fine.

OS X is version 10.6.4.

Any suggestions are appreciated.

Thanks,

+1  A: 

In order to see what Applescript commands any application supports, then you need to look at the Dictionary for the application. From my answer to a similar question posted just the other day:

To get to an application's Dictionary in the the Applescript Editor go to File > Open Dictionary.... A list of all the applications that the OS knows supports Applescript will appear, but the OS won't catch them all so you can use the Browse button. If an application doesn't support Applescript, then it won't be selectable in the dialog window.

The caveat to this is that there are certain commands that an application is supposed to support but don't, or an application may only support the minimum requirements. These are all very, very simple like open, quit, etc. Your mileage may vary.

Information to start with GUI scripting can be found on the OS X Automation site. GUI Scripting is a funky way to go, and I don't think you can get the values of onscreen controls, instead only set them. You should only do this if no other avenue works.

If you wish to stick with Python, then you can look at the py-appscript project, but this is still dependent on Applescript support of the application.

Philip Regan
Thanks Philip ... that py-appscript suggestion was useful.Unfortunately the app doesn't have a dictionary, so UI scripting is all I have.However I think I managed to do it. You can get the value of some element with something like ... "get value of text field 1 of row 1..."; and this is useful for error reporting.
Alexandru Nedelcu
I'm not surprised by the lack of a dictionary. Applescript has, more or less, fallen out of favor with Apple, it seems. They only do implementations in their more public, flagship apps, and even then it could be argued that they are feature-incomplete. In those cases, GUI scripting is really the only way to go. The one real pitfall that I know of (other than the syntax and keeping track of which control you are manipulating) is that unintended alert and dialog windows may (and will) cause the script to error out. Good luck!
Philip Regan
Yeah, I already had some issues with unintended alerts / dialog boxes. But to minimize such instances, when the script starts, I first terminate the application to get rid of the previous state. If it can't be terminated normally (like in the case the app asks for confirmation or something) I'm then doing a "kill -9". Starting from scratch on every action sure helps a lot in that regard.
Alexandru Nedelcu