I am trying to use an Applescript for the PDF services so that I can name the pdf file rather than just accepting the default.
However, I can’t figure out the appropriate syntax from the example in the manual or the dictionary. My script:
on open dropped_item
set this_file to item 1 of dropped_item
tell application “Finder”
activate
set the file_name to the name of this_file
set the parent_folder to the container of this_file
repeat
display dialog “Enter a name for file:” default answer file_name
set this_name to the text returned of the result
if this_name is not “” then
if this_name does not end with “.pdf” then
set this_name to this_name & “.pdf”
end if
exit repeat
end if
end repeat
set the name of this_file to this_name
set this_file to (item this_name of the parent_folder) as alias
end tell
PDF Services Script to “Save PDF to EagleFiler (Ask For Filename)”
This is working for me:
on open dropped_item
set this_file to item 1 of dropped_item
tell application "Finder"
activate
set the file_name to the name of this_file
set the parent_folder to the container of this_file
repeat
display dialog "Enter a name for file:" default answer file_name
set this_name to the text returned of the result
if this_name is not "" then
if this_name does not end with ".pdf" then
set this_name to this_name & ".pdf"
end if
exit repeat
end if
end repeat
set the name of this_file to this_name
set this_file to (item this_name of the parent_folder) as alias
end tell
tell application "EagleFiler"
tell library document 1
import files {this_file}
end tell
end tell
end open
It will import the PDF into the frontmost library. In order to specify the library in the script, you can do something like this:
tell application "EagleFiler"
open POSIX file "/Users/mjt/Test/Test.eflibrary"
tell document "Test.eflibrary"
import files {this_file}
end tell
end tell
It works fine for me in Safari if I just click the link. It starts out as attachment.php and then the name changes to EagleFilerPDFService.scpt.zip. Perhaps if you just rename the file that you downloaded it will work.