is there a problem with GUI scripting in Illustrator??

G’day

I’m trying to interact with the flatten transparency box in illustrator, but the following just results in an error.

Is there a problem with illustrator, or is my code wrong?


tell application "System Events" to tell process "Adobe Illustrator"
	activate
	delay 0.1
	set title of pop up button 1 of window "Flatten Transparency" to "[High Resolution]"
end tell

Model: intel iMac
Browser: Safari 525.18
Operating System: Mac OS X (10.5)

Hi Santa,

your code activates System Events, but Illustrator should be activated


tell application "System Events" to tell process "Adobe Illustrator"
	set frontmost to true -- activates Illustrator
	delay 0.1
	set title of pop up button 1 of window "Flatten Transparency" to "[High Resolution]"
end tell

G’day Stefan

Thanks for that, but unfortunately I still get the same error ‘Apple Event handler failed’, on the ‘set title’ line.

The full script is…


tell application "System Events" to tell process "Adobe Illustrator"
	set frontmost to true -- activates Illustrator
	delay 0.1
	keystroke "a" using {command down}
	click menu item "Flatten Transparency..." of menu 1 of menu bar item "Object" of menu bar 1
	delay 0.1
	tell window "Flatten Transparency"
		set title of pop up button 1 to "[High Resolution]"
	end tell
end tell

EDIT This doesn’t work either


tell application "System Events" to tell process "Adobe Illustrator"
	set frontmost to true -- activates Illustrator
	delay 0.1
	keystroke "a" using {command down}
	click menu item "Flatten Transparency..." of menu 1 of menu bar item "Object" of menu bar 1
	delay 0.1
	tell window "Flatten Transparency" to tell pop up button 1
			set current menu item to (first menu item whose title is  "[High Resolution]")
	end tell
end tell

Regards

Santa

Model: intel iMac
Browser: Safari 525.18
Operating System: Mac OS X (10.5)

The menu items of a popup button are only accessible, when they are visible,
so first click on the button, then choose the menu item


tell application "System Events" to tell process "Adobe Illustrator"
	set frontmost to true -- activates Illustrator
	keystroke "a" using command down
	click menu item "Flatten Transparency..." of menu 1 of menu bar item "Object" of menu bar 1
	tell window "Flatten Transparency"
		tell pop up button 1
			click
			delay 0.5
			pick menu item "[High Resolution]" of menu 1
		end tell
		click button "OK"
	end tell
end tell

your 0.1 delays are not necessary

Thanks Stefan, that works a treat.

Regards

Santa