Re: PDF Services - I'm lost...
Re: PDF Services - I'm lost...
- Subject: Re: PDF Services - I'm lost...
- From: Matthew Smith <email@hidden>
- Date: Wed, 13 Aug 2003 09:45:13 +1000
on 12/08/2003 11:26, Michael Cytrynowicz at email@hidden wrote:
>
What I am having trouble is with creating a script which will do the
>
following:
>
>
(1) print to pdf to any folder of my choice and right after
>
(2) copy the newly created pdf's name to the clipboard
>
>
I tried saving a script to the PDF Services folder that was like this:
>
>
on open these_items
>
set the clipboard to first item of these_items as text
>
end open
>
>
And, printing from Safari, I get this:
>
>
Dodecaide:private:tmp:printing.1136.2:Print job.pdf
>
The pdf is spooled to the tmp folder, with name "Print job.pdf"
>
If I run Apple's Mail script, it attaches to a new mail, equally, a
>
pd file with name "Print job.pdf"
>
>
However, if instead of "printing" to a script, I print to a folder
>
(through its alias placed in PDF Services folder) - then I get,
>
correctly a pdf file whose name is the title of the corresponding
>
Safari page.
The PDF service is given a file with the name "Print job.pdf". It won't give
you anything else. You could ask Safari for the title of the frontmost
window. Won't it be the window being printed? You would somehow have to know
that you were printing from Safari, as the PDF service could be used from
any application.
What I would normally do is ask the user to give the file a better name
using "display dialog".
on open these_items
set this_file to item 1 of these_items
tell application "Finder"
set the file_name to the name of this_file
end tell
tell application (path to frontmost application as string)
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 exit repeat
end repeat
end tell
tell application "Finder"
set the name of this_file to this_name
end tell
...
end open
--
Matthew Smith
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.