Acrobat 7.0 Professional UI scripting query

Hi There,

Please can some one help me.
I’m putting together a script for Adobe Acrobat and to cut a long story short I’ve a slight problem when I come to saving the file.

The UI script is ok right up to the ‘Save As’ dialog.
If the file already exists, which it does, a popup appears asking the user if they’d like to replace the file with the one you’re saving.
I’m trying to script the UI to click the ‘Replace’ button - this is where the error occurs. I’m not sure how I refer to this particular button in the popup. I’ve used the UI Inspector to try and find out the window name but under AXWindow: I get nothing?

I’m also trying to test if this popup or window exists before I try and click on this button.

Any help would be appreciated.

Thanks in advance,


Further to my earlier post I’ve now got this:-

if ((first window whose description is "dialog") exists) then
					click button "Replace" of (first window whose description is "dialog")
				end if

However I get the error:-

System Events got an error:
NSReceiverEvaluationScriptError: 4

The script can tell the window exists because I’ve stuck a dialog box in to check it’s getting that far, it must be the button press that is generating the error.

Any help would be appreciated.


Model: G5
Browser: Internet Explorer 6.0
Operating System: Mac OS X (10.4)

I find it best to take the simplest route with system events. I would just use a ghost kestroke of Command-r to click the “Replace” button rather than try to figure ot how to target the button in the window, etc.

tell application "System Events"
			keystroke "r" using {command down}
		end tell

Hi Matt-Boy,

Sorry I’ve not replied sooner.
Thanks for the suggestion, I’ll implement the change and let you know how I’ve got on.

I’ve still not been able to work out the name of the dialog box which is a little frustrating.



I just tested this code and it worked on a document I had open in Acrobat. Hopefully this can point you in the right direction.

tell application "Adobe Acrobat 7.0 Profe#5DC"
	delay 2
	tell application "System Events"
		tell process "Acrobat"
			pick menu item "Save As..." of menu "File" of menu bar item "File" of menu bar 1
			delay 2
			keystroke return
			delay 4
			keystroke "r" using {command down}
		end tell
	end tell
end tell

Model: Mac G5 OS 10.3.9
Browser: Safari 312.3.1
Operating System: Mac OS X (10.3.9)

tell application "Adobe Acrobat 7.0 Pr#2974C3"
							save the first document to file filenameinhere replacing yes
							close the first document
					end tell