Help With Clicking

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.

Click here:
http://i301.photobucket.com/albums/nn50/Spyros_z/ScreenShot1.png
and then here:
http://i301.photobucket.com/albums/nn50/Spyros_z/ScreenShot2.png

The code I am currently using (with no result) is:


tell application "System Events" to tell application process "TrueCrypt"
			click button at {1156, 749}
		end tell

Any help is much appreciated.

Hi,

the syntax

click something at {x, y}

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

tell application "System Events" to tell application process "TrueCrypt"
	click button 7 of UI element 5 of window "TrueCrypt"
end tell

I have the correct way to find the button now, but when I run this, I have no result. When I run the same code with

click button "Select File..."

I get an error message…

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