I made a GUI script to enable usage rights in Acrobat, but I would like it to turn it into a droplet that runs the GUI based on the number of files dropped onto it instead of telling it to repeat # of times. Is this possible with GUI scripting?
display dialog "This is a GUI script that will Enable Usage Rights in Adobe Reader." & return & return & ¬
"It will save over the original file." & return & return & "It will process 50 PDFs at a time." & return & return & ¬
"Let the script run, do not click anything else on your machine." with icon caution
on do_menu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
--Up the delay for a lot of files
delay 40
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu
do_menu("Adobe Acrobat Professional", "File", "Open...")
on do_submenu(app_name, menu_name, menu_item)
try
-- bring the target application to the front
tell application app_name
activate
end tell
tell application "System Events"
tell process app_name
--How many Files?
repeat 50 times
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
delay 1
keystroke return
delay 1
keystroke return
delay 1
keystroke "r" using {command down}
delay 1
keystroke "w" using {command down}
end tell
end tell
end tell
end repeat
end tell
end tell
return true
on error error_message
return false
end try
end do_submenu
do_submenu("Adobe Acrobat Professional", "Advanced", "Enable Usage Rights in Adobe Reader...")
-- Display a done dialog box to the user after script executes.
tell application "Finder"
activate
display dialog "Done." buttons {"OK"} default button 1
end tell
Thank you,
N