Hey Guys, I have a script that I have written that automatically enables security settings on a PDF through Acrobat Professional. Because of Acrobats poor scriptability I am forced into doing much though System Events.
This is not a major problem… however when activating some settings in the security settings, often warning Alert dialog boxes appear when you tell System Events to enable particular settings. These Alerts do not have a title… The only way I have been able to get the script to deal with them is with the following code:
if title of front window is "" then
tell front window
click button "OK"
end tell
end if
I guess this is an ok solution… bit hard to identify windows when they don’t have titles…
BUT this is not my main problem. The main problem is that the script gets to one of these alert dialog boxes and just sits there… It sits there for like 10 seconds and then it performs the “click button “OK”” command.
This is a problem as there are like 3 of these instances and it really adds up. Can anybody help me… I am using Acrobat Professional 8.2.0 and the entire code is:
tell application "System Events"
try
tell process "Acrobat"
-- Enable security settings
click menu item "Properties..." of menu "File" of menu bar item "File" of menu bar 1
tell window "Document Properties"
tell tab group 1
click radio button "Security"
tell group "Document Security"
click pop up button 1
click menu item 2 of menu 1 of pop up button 1
end tell
end tell
end tell
tell window "Password Security - Settings"
click pop up button 1
click menu item 4 of menu 1 of pop up button 1
tell group "Permissions"
click checkbox "Restrict editing and printing of the document. A password will be required in order to change these permission settings."
click text field 1
keystroke pdfPassword
click pop up button 1
click menu item 2 of menu 1 of pop up button 1
click pop up button 2
click menu item 4 of menu 1 of pop up button 2
end tell
click button "OK"
end tell
if title of front window is "" then
tell front window
click checkbox 1
click button "OK"
end tell
end if
tell window "Adobe Acrobat - Confirm Permissions Password"
click text field 1
keystroke pdfPassword
click button "OK"
end tell
if title of front window is "" then
tell front window
click checkbox 1
click button "OK"
end tell
end if
tell window "Document Properties"
click button "OK"
end tell
end tell
on error
display alert "System Events was unable to Enable Commenting. This may be because Acrobat has modified its menu system. Please contact your system administrator."
end try
end tell