Hi,
I would like to be able to drag and drop a pdf on a script that opens the file in Acrobat, reduces the file size, adds “proof” to the end of the file name and then closes it.
I’m not sure where to start.
Any suggestions?
Thanks,
Jeremy
Hi,
I would like to be able to drag and drop a pdf on a script that opens the file in Acrobat, reduces the file size, adds “proof” to the end of the file name and then closes it.
I’m not sure where to start.
Any suggestions?
Thanks,
Jeremy
Jeremy,
I don’t have acrobat 8 but I do have 7 standard and there doesn’t seem to be any direct access to that function. I us http://www.accesspdf.com/pdftk/ to compress my pdfs and it works quite well
Here is what I have so far:
activate application "Adobe Acrobat Professional"
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
delay 2
click button "Save" of window "Save As"
delay 1
click button "Replace" of window 1
delay 5
end tell
end tell
tell application "Adobe Acrobat Professional" to close documents
But I need to have the pdf open in Acrobat for this script to work.
I would like to have it set up to open from the desktop by creating a droplet. I would like it to save the file with “proof” at the end.
How do I get Applescript to open dropped file in Acrobat?
try compiling this against your version 8
********* Warning This code has not been tested *****************
on open thefiles
repeat with afile in thefiles
set {name:fileName} to info for afile
if fileName contains "." then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set fileName to item 1 of fileName
set AppleScript's text item delimiters to tid
end if
set OutFile to fileName & "_proof"
tell application "Adobe Acrobat 7.0 Standard"
activate
open afile
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
delay 2
click button "Save" of window "Save As"
delay 1
keystroke OutFile
click button "Replace" of window 1
delay 5
end tell
end tell
end tell
end repeat
end open
on open thefiles
repeat with afile in thefiles
set {name:fileName} to info for afile
if fileName contains "." then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set fileName to item 1 of fileName
set AppleScript's text item delimiters to tid
end if
set OutFile to fileName & "_proof"
tell application "Adobe Acrobat Professional"
activate
open afile
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
keystroke OutFile
delay 1
click button "Save" of window "Save As"
delay 1
end tell
end tell
end tell
end repeat
end open
That worked, except it is getting only the first character of the file name. How do I get the whole file name?
sorry my bad, I modified the script I put notes in where I changed code ohh and don’t forget to save it as an app
on open thefiles
repeat with afile in thefiles
set {name:fileName} to info for afile
if fileName contains "." then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set fileName to text item 1 of fileName -- this is the line I changed to correct the file name problem
set AppleScript's text item delimiters to tid
end if
set OutFile to fileName & "_proof.pdf" -- I added .pdf here I'm not sure if it is needed or not
tell application "Adobe Acrobat 7.0 Standard"
activate
open afile
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
keystroke OutFile
delay 1
click button "Save" of window "Save As"
delay 1
end tell
end tell
end tell
end repeat
end open
on open thefiles
repeat with afile in thefiles
set {name:fileName} to info for afile
if fileName contains "." then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set fileName to text item 1 of fileName
set AppleScript's text item delimiters to tid
end if
set OutFile to fileName & " proof"
tell application "Adobe Acrobat Professional"
activate
open afile
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
keystroke OutFile
delay 1
click button "Save" of window "Save As"
delay 1
click button "Replace" of window 1
delay 5
end tell
end tell
end tell
tell application "Adobe Acrobat Professional" to close documents
end repeat
end open
I thought I had it figured out. But now if there isn’t a file to replace it gives me an error when running.
try this
on open thefiles
repeat with afile in thefiles
set {name:fileName} to info for afile
if fileName contains "." then
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."
set fileName to text item 1 of fileName
set AppleScript's text item delimiters to tid
end if
set OutFile to fileName & " proof"
tell application "Adobe Acrobat 7.0 Standard"
activate
open afile
tell application "System Events"
tell process "Acrobat"
click menu item "Reduce File Size..." of menu 1 of menu bar item "Document" of menu bar 1
click button "OK" of window "Reduce File Size"
keystroke OutFile
delay 1
click button "Save" of window "Save As"
delay 1
if exists button "Replace" of window 1 then click button "Replace" of window 1
delay 5
end tell
end tell
end tell
tell application "Adobe Acrobat 7.0 Standard" to close documents
end repeat
end open
Thanks! You’re Awesome!!