Hello all,
I am at a roadblock. I need to apply a watermark to a pdf that is only viewable when printed, then prevent it from being removed by locking the pdf with a password, all with applescript. I investigated the dictionarys of acrobat pro and image events, but could not find anything on either topic. I also searched the net and this forum but to no avail. Could one of you wonderful people please assist me in this problem, or at least point me in the right direction? Thanks a bunch.
Chuckles
–edit–
Is it possible, if not with scripting the app direct, to use system events to achieve the thing I want?
Cheers.
I am reposting this as I really need to figure this out. I am attempting to use system events to achieve the things I want but I have become lost at filling in a form using UI scripting. I have gotten the form to activate using UI but beyond that I need help!
Please, you generous knowledgeble people, I request your know-how.
Well this is a first. I have never completed an entire post by myself. I figured it out, but I couldn’t have done it without this nifty app I found called UI Browser. http://www.prefab.com/uibrowser/ When I wanted to press a button, check a box or whatever, I just used the browsers hot key to get the path of it, then had it output the command in applescript. Fantastic little app. Heres the complete script.
tell application "Adobe Acrobat 7.0 Professional"
activate
if exists document 1 then
tell application "System Events"
tell application process "Acrobat"
click menu item 4 of menu 1 of menu bar item 6 of menu bar 1
click radio button "Add a Watermark (appears on top of page)" of group 1 of group 5 of group 1 of window "Add Watermark & Background"
set onScreen to get value of checkbox "Show when displaying on screen" of group 1 of group 5 of group 1 of window "Add Watermark & Background"
if onScreen = 1 then
click checkbox "Show when displaying on screen" of group 1 of group 5 of group 1 of window "Add Watermark & Background"
end if
set value of text field 2 of group 1 of group 4 of group 1 of window "Add Watermark & Background" to "Property of" & return & "Shepparton News"
click button "Center Align Text" of group 1 of group 4 of group 1 of window "Add Watermark & Background"
click radio button "Fit to page" of group 1 of group 3 of group 1 of window "Add Watermark & Background"
set value of text field 1 of group 2 of group 1 of group 3 of group 1 of window "Add Watermark & Background" to "20"
click checkbox "Prevent resizing/repositioning when printing" of group 1 of group 3 of group 1 of window "Add Watermark & Background"
set value of text field 1 of group 1 of group 1 of group 3 of group 1 of window "Add Watermark & Background" to "20"
click button "OK" of group 1 of window "Add Watermark & Background"
delay 3
click menu item "Secure This Document..." of menu 1 of menu item "Security" of menu 1 of menu bar item "Document" of menu bar 1
if not (exists static text "PrePress Security" of group 1 of row 2 of outline 1 of scroll area 1 of group 1 of window "Select a Policy to Apply") then
delay 1
click button 5 of group 1 of window "Select a Policy to Apply"
delay 1
click radio button "Use passwords" of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
click button "Next >" of group 1 of window "New Security Policy"
delay 1
set value of text field 2 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy" to "PrePress Security"
click button "Next >" of group 1 of window "New Security Policy"
delay 1
set PassForOpen to get value of checkbox "Require a password to open the document" of group 1 of group 2 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
if PassForOpen = 1 then
click checkbox "Require a password to open the document" of group 1 of group 2 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
end if
set UsePassword to get value of checkbox "Use permissions password to restrict editing of security settings" of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
if UsePassword = 0 then
click checkbox "Use permissions password to restrict editing of security settings" of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
end if
delay 1
set value of text field 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy" to "Apples"
click menu item "Low Resolution (150 dpi)" of menu 1 of pop up button 2 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "Editing a Security Policy"
set ChangesSettings to get value of pop up button 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
if ChangesSettings ≠0 then
set value of pop up button 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy" to 0
end if
set CannotCopy to get value of checkbox "Enable copying of text, images, and other contents" of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
if CannotCopy = 1 then
click checkbox "Enable copying of text, images, and other contents" of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "New Security Policy"
end if
click button "Next >" of group 1 of window "New Security Policy"
delay 1
set value of text field 1 of group 1 of window "Acrobat Security" to "Apples"
click button "OK" of group 1 of window "Acrobat Security"
delay 1
click button "Finish" of group 1 of window "New Security Policy"
delay 1
click button "Apply" of group 1 of window "Select a Policy to Apply"
else
click button "Cancel" of group 1 of window "Select a Policy to Apply"
delay 1
click menu item "1 PrePress Security" of menu 1 of menu item "Security" of menu 1 of menu bar item "Document" of menu bar 1
end if
click menu item "Save" of menu 1 of menu bar item "File" of menu bar 1
end tell
end tell
end if
end tell
Too easy with this app. Did it with the trial version, but am looking at purchasing.
Chuckles:D