Problem with a very simple little GUI script.

Hey all,

I’ve got a problem with a very simple little GUI script. The goal is to set up a quick script that will take users in the office through the Panther method of connecting to our fileserver. It’s meant to open the Connect To Server window, enter the URL, add it to the qwuick list, then bring up the log in, open the Options screen, add the keychain settings, and then complete the process.

However, I’m gotten to the point where it tries to open the Options window, but it’s not working. I can see the the Options button flash as though it were clicked, but the Options screen doesn’t appear.

Any suggestions?

B

tell application "Finder"
	activate
	tell application "System Events"
		tell application process "Finder"
			keystroke "k" using command down
			delay 2
			keystroke "foo.bar"
			click button 7 of window "Connect To Server"
			click button "Connect" of window "Connect To Server"
			delay 1
			click button "Options..." of window 1
		end tell
	end tell
end tell

This probably not what you want to hear but some things just don’t work with GUI Scripting. I’ve been trying for months to write a script to turn on/off “Show genre when browsing” in iTunes by clicking the checkbox in iTunes preferences using GUI scripting. Just like you described, the checkbox highlights like it was clicked, but the check never appears/disappears. I’ve tried everything I can think of, changing the “AXValue” attribute of the checkbox from “0” (not checked) to “1” (checked) since this is a good workaround for setting “focused” of a UI element not working, instead you change the “value of (attribute “AXFocused”)”, but it doesn’t work for checkboxes.

You can test using “UI Element Inspector” (installed with dev tools) and lock on to the option button by pressing cmd-f10 while the mouse is over the “Options…” button. Then at the bottom of the second UI Element Inspector window that opens it list actions which can be performed on the button (in this case it would be “Press”) Click the “Perform Action” button and see if that can click the Option button, chances are it can’t.

So it looks like all I can tell you is that you’re not alone in this. Submit feedback to Apple about it at http://www.apple.com/macosx/feedback/

It seems that’s the case exactly. Sigh.

Oh well, thanks for the UI Element Inspector tip anyways. That’s going come in handy for my other plans.

B

P.S. In case anyone else reads this in the future…while I didn’t manage to find the UI Element Inspector program in the Dev Tools stuff, I did find it here:

http://www.apple.com/applescript/uiscripting/