Script not working in new operating system!!!

Hello all, I have an Acrobat 8 script that worked fine in OS X 10.4. Now that i have upgraded to 10.5 there seems to be an issue with the script. Everything works fine until it gets to the line “repeat until exists button Replace” . Once the {Cancel, Replace} buttons appear the script refuses to click the Replace button. Any suggestions or ideas? Thanks in advance.

set the_container to choose folder
tell application "Finder"
	try
		set fileNameList to (every file in entire contents of the_container whose name ends with ".pdf") as alias list
	on error
		set fileNameList to (every file in entire contents of the_container whose name ends with ".pdf") as alias as list
	end try
end tell

activate application "Adobe Acrobat Professional"
tell application "Adobe Acrobat Professional"
	repeat with iFile from 1 to count fileNameList
		set thisFilePath to item iFile of fileNameList
		set thisFilePath to thisFilePath as string
		open file thisFilePath
		activate application "Adobe Acrobat Professional"
		tell application "System Events"
			tell process "Acrobat"
				click menu item "Enable Usage Rights in Adobe Reader..." of menu 1 of menu bar item "Advanced" of menu bar 1
				tell window 1
					repeat until exists button "Continue"
						delay 0.25
					end repeat
					click button "Continue"
					repeat until exists button "Save Now"
						delay 0.25
					end repeat
					click button "Save Now"
					repeat until exists button "Save"
						delay 0.25
					end repeat
					click button "Save"
					repeat until exists button "Replace"
						delay 0.25
					end repeat
					click button "Replace"
				end tell
				close front document
				
			end tell
		end tell
	end repeat
end tell

Can’t answer the question, but I inserted the AppleScript tags so potential helpers could easily download your script.

In Acrobat 8 on Leopard the replace dialog is a sheet to the window so change that segment of code to this.


repeat until exists button "Replace" of sheet 1
	delay 0.25
end repeat
click button "Replace" of sheet 1

Thank you, thank you, thank you!!! Is the “Replace” command the only one that is a sheet, or are there others?

Hi Chuck,

Well the answer is yes, but it’s hard to know what is and isn’t without looking at it visually or with a UI inspector.

Ok. I’ll start using the UI inspector a little more. Thanks again for your help.