UI Browser generated code problem

HI Folks-

I recently acquired UI Browser and have been attempting to use it to generate code. For example, I asked for a “click selected element” statement from the Print dialog box in InDesign and UI Browser came up with:


click button "Print"  of window "Print" 

or


click button 4 of window 1

depending on whether I stipulate referencing name or index. In either case Script Editor gives the following error “Expected end of line, etc. but found class name.”, highlighting the word ‘button’.

Do I need to be using a different editor? Do I need to “UI enable” Script Editor?

The reason I’m going through this exercise is that I would like to print EPS files from InDesign, and right now it hangs up on the ‘print’ window. Unlike the export function, it doesn’t seem possible to add


without showing options

the current file is as follows:


on adding folder items to this_folder after receiving added_items
	activate application "Adobe InDesign CS2"
	tell application "Adobe InDesign CS2"
		open added_items
		print active document using "postscript"
	end tell
end adding folder items to

thanks!

Ralph

Well two things, when using GUI Scripting you need to make sure that 1: It’s enabled in the ApplScript Utility and two that you are referencing your commands properly.

So for example with InDesign CS2 if I wanted to click the Print button in an already open print dialog I would use this code…

tell application "System Events"
	tell process "InDesign"
		click button "Print" of window "Print"
	end tell
end tell

I have ‘enable access for assistive devices’ selected in the System Preferences. Is this what you’re referring to?

thanks,

Ralph

In the Applications folder is another folder called AppleScript. In there a application “AppleScript Utility”. Make sure Enable GUI Scripting is on in there. I know it also turns on assistive devices, but not sure if it works the other way around.

Great- I have that all enabled. The following code still doesn’t click the ‘save’ button (the print preset ‘postscript’ changes the button from a ‘print’ to a ‘save’


on adding folder items to this_folder after receiving added_items
	activate application "Adobe InDesign CS2"
	tell application "Adobe InDesign CS2"
		open added_items
		print active document using "postscript"
	end tell
	tell application "System Events"
		tell process "InDesign"
			click button "Save" of window "Print"
		end tell
	end tell
end adding folder items to

thanks,

Ralph