I only started working with AppleScript yesterday, and given the short amount of time I’ve been on a mac, and using applescript, I’m quite happy with how I’m doing. However, I am trying to automate the opening of certain applications, and I am stuck. The problem is that I am using TrueCrypt with a volume which I have saved on a flashdrive, and I need to tell Applescript to click somewhere in TrueCrypt, and then to select the volume in the file browser.
doesn’t work. You should determine the hierarchy of the UI elements and use a syntax like
activate application "TrueCrypt"
tell application "System Events" to tell application process "TrueCrypt"
click button "Select File." of group 2 of window 1
end tell
I don’t use TrueCrypt, so the reference above is arbitrary and will certainly not work.
Try Apple’s UIElementInspector, which can help to determine the proper UI element.
GUI scripting is dreadful, because most of the work is trial and error
Thanks for the help. So, there’s no way I can easily generate the code? Also, can you give me a hand as to what I should be looking for in UI Element Inspector?
GUI scripting is never easily, because you can test the scripts only with the original environment i.e. the required applications and the same system version
the character after “Select File” could be a horizontal ellipsis (⌥ period) not three periods.
And for GUI scripting you have to enable “Enable access for assistive devices” in the PrefPane Universal Access