[Acrobat7] Stuck in GUI popup window

I want to set Color Management policies for Acrobat 7 using GUI, but being stuck in the popup window “Preferences”. My script as follows:-

tell application "Adobe Acrobat 7.0 Professional"
	activate
	tell application "System Events"
		tell process "Acrobat"
			click menu item "General..." of menu 1 of menu item "Preferences" of menu 1 of menu bar item "Acrobat" of menu bar 1
			delay 2
			select row 5 of table 1 of scroll area 1 of tab group 1 of window "Preferences"
			delay 2
		end tell
	end tell
end tell

I received an error:

NSReceiverEvaluationScriptError: 4

while execute this line:

select row 5 of table 1 of scroll area 1 of tab group 1 of window “Preferences”

Please advise! Thanks!

I don’t know if it will make a difference, but you have the system events code inside of the “tell application adobe…” block of code. The adobe application doesn’t know anything about system events. They’re 2 totally separate applications and as such they shouldn’t be inside the same “tell” block of code. Try separating them… it might help.

Thanks for your advice, Hank.

I tried as suggested but still having the same problem and message.

tell application "Adobe Acrobat 7.0 Professional"
	activate
end tell
tell application "System Events"
	tell process "Acrobat"
		click menu item "General..." of menu 1 of menu item "Preferences" of menu 1 of menu bar item "Acrobat" of menu bar 1
		delay 2
		select row 5 of table 1 of scroll area 1 of tab group 1 of window "Preferences"
		delay 2
	end tell
end tell

May I know am I having syntax error in that line? May I know how can I retrieve the content of the option the moment I enter this popup window?

Thanks!

I tried download 1 30 days trial PreFab UI Browser but it seems does not support popup menu.

Could someone help me on this please… Tks!

Could someone please give me a direction on this issue?

To start with a easier GUI diagnose, I first launch Acrobat 7.0 Pro and enter into Preferences>General… , then select “Covert to PDF” manually. My intention is to use GUI script to press the button “Edit Settings…”

From here on, I trial and error the following script (not successful), but still not be able to figure out what syntax to use. The “Edit Settings…” button should be addressed as ‘pop up button’ or ‘radio button’ or just ‘button’? Which group it is belonging to?

tell application "Adobe Acrobat 7.0 Professional"
	activate
end tell
tell application "System Events"
	tell process "Acrobat"
		click menu item "General..." of menu 1 of menu item "Preferences" of menu 1 of menu bar item "Acrobat" of menu bar 1
		delay 2
		click pop up button 1 of group 2 of group 1 of window "Preferences"
		--both of the follwings work, but couldn't figure out which is which
		--click button 2 of group 1 of window "Preferences" --button 2 refer to "OK" or "Cancel" ?
		--click button 1 of group 1 of window "Preferences" --button 1 refer to "OK" or "Cancel" ?
		delay 2
	end tell
end tell

I successfully use the following line to close the pop up window, but don’t know which button (“OK” or “Cancel”) is being pressed.

click button 2 of group 1 of window "Preferences"

Please help! Thanks!

Hi

Here is an example that works here.
But, I do not have a menu item “General …” in the menu “Preferences” → “Acrobat”.

My script use XTool.osax, you can download at : http://www.lestang.org/osax/XTool/

tell application "Adobe Acrobat 7.0 Professional" to activate

tell application "System Events" to tell process "Acrobat"
	click menu item "Preferences..." of menu 1 of menu bar item "Acrobat" of menu bar 1
	delay 1
	tell window "Preferences"
		select (first row of outline 1 of scroll area 1 of group 1 whose value of static text 1 is "Convert to PDF")
		delay 1
		tell group 1 of group "Converting To PDF" of group 1 of group 1 of group 1
			set x to (count scroll areas)
			select (first row of outline 1 of scroll area x whose value of static text 1 is "PNG")
			delay 0.5
			click button "Edit Settings..."
			delay 2
		end tell
	end tell
	tell window "Adobe PDF settings"
		my clickobject(position of pop up button 5) -- popup color :  need a real mouse click (XTool.osax), otherwise, it does not take modification
		delay 0.3
		click menu item "JPEG (Quality : Maximum)" of menu 1 of pop up button 5
		delay 1
		keystroke return -- close window "Adobe PDF settings"
	end tell
	delay 1
	click button "OK" of group 1 of window "Preferences"
end tell

on clickobject(p) --  XTool.osax
	move mouse p
	click mouse times 1 delay 0.3 using primary button
end clickobject

Operating System: Mac OS X (10.5.7)

Hi Jacques,

Thanks for your great help! Its almost there.

Strange, my version of Acrobat 7.0 Pro do have the menu “General …” in the menu “Preferences”. So I modify the line from:

click menu item "Preferences..." of menu 1 of menu bar item "Acrobat" of menu bar 1

to:

click menu item "General..." of menu 1 of menu item "Preferences" of menu 1 of menu bar item "Acrobat" of menu bar 1

But, it then stuck at “count scroll areas” in the line:

set x to (count scroll areas)

Hope to receive your advice again! Thanks!

Hi

I test it on (Mac OS X 10.4.11), the group “Converting To PDF” doesn’t exists

We must replace this line : tell group 1 of group “Converting To PDF” of group 1 of group 1 of group 1
by this

tell group 1 of group 1 of group 1 of group 1 of group 1

Great! Jacques! It works fine now on my PPC Tiger Acrobat 7.0 Pro after this slight adjustment.

But I’m confused with those levels of groups, I would appreciate it if you could explain to me the logic behind or advise me which manual to refer to.

Meanwhile, I will follow your direction to tackle other settings. May need your help further. Thanks in advance!

Hi

There is no documentation for that.

This is my method to find ui elements in a window.
For example a table or outline, the window is open before running the script

tell application "System Events" to tell process "Acrobat"
	set a_list to {}
	repeat with i in (get entire contents of window "Preferences")
		tell i to if class is in {outline, table} then set end of a_list to contents
	end repeat
	return a_list
end tell

(* to find other objects, replace {outline, table} with an item in this list 

( browser, busy indicator, button, checkbox, color well, column, combo box, drawer, group, grow area, image, incrementor, list,  menu button,  outline, pop up button, progress indicator, radio button, radio group, relevance indicator, row, scroll area, scroll bar, sheet, slider, splitter, splitter group, static text, tab group, table, text area, text field, tool bar, value indicator)
*)

After you have to do a test to determine which is the outline, by selecting the last row for example :

tell application "System Events" to tell process "Acrobat"
	select last row of outline 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "Preferences"
end tell

To find out what ui elements a row contains (text field, static text, …)

tell application "System Events" to tell process "Acrobat"
	return UI elements of row 1 of outline 1 of scroll area 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "Preferences"
end tell

Thanks a lot, Jacques! I really appreciate your kind sharing.

Your method is much better than documentation (even if it exists) - short and sweet! I am sure I will benefit a lot from your sharing.

Although it is time consuming to find the class and UI elements, it worth the effort to do so. I will do a further explore on it.

Thanks again!