• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDF Services - I'm lost...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDF Services - I'm lost...


  • Subject: Re: PDF Services - I'm lost...
  • From: Michael Cytrynowicz <email@hidden>
  • Date: Tue, 12 Aug 2003 21:39:38 +0200

Matthew - thanks for responding!

Yes, I am aware of the way PDF Services work - I've been pdf printing
to folder aliases placed in the PDF Services folder in my Library.

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
(3) really work :-)

This is what I have so far (adapted from Apple's Mail script example,
and still has stuff that's not really needed) - it worked for a
while, then (don't ask me what I did, I can't remember) broke
displaying: "can't continue"

<script>
on open these_items
try
set this_file to item 1 of these_items
tell application "Finder"
set the file_name to the name of this_file
set the parent_folder to (the container of this_file) as alias
end tell
tell application "Safari"
set the xfile_name to the name of front window as Unicode text
set the clipboard to xfile_name
set filename_length to the length of xfile_name
if filename_length > 255 then beep
end tell
tell application "Finder"
set the name of this_file to (xfile_name & ".pdf")
set the clipboard to the name of file this_file as text
set targetfolder to choose folder
duplicate this_file to targetfolder without replacing
delete folder parent_folder
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application (path to frontmost application as string)
display dialog error_message buttons {"OK"} default button 1
end tell
else
tell application "Finder" to delete parent_folder
end if
end try
end open
</end script>


Any ideas?

Best,

Mike




At 03:05 +0200 8/12/03, Michael Cytrynowicz wrote:
on 12/08/2003 10:17, Michael Cytrynowicz at email@hidden wrote:

> No responses to my earlier post - so I tried to figure it out by
> myself, but, I can't - so if any charitable soul is willing to lend
...snip...
> item in the list - but nada, zero. I am beginning to feel very dumb.
> What am I missing?

I think you misunderstand what PDF Services is. PDF Services are not invoked
when something is printing. You invoke a PDF Service from the print dialog
instead of printing. There is a button at the bottom of the window that pops
up a menu of the services. You choose one of them. The print subsystem
creates a PDF which you can then process. This is done by passing a list
containing an alias to the PDF file to the "on open" handler"

So for the example of attaching the file to a mail message. What you do is
go to print a document. Instead of hitting the Print button in the print
dialog, you choose the PDF Service from the popup menu button in the bottom
of the dialog. A PDF file is created and the "on open" handler is called in
the PDF Service, with the parameter being a list containing only the alias
to the PDF file. The script then uses the alias (the first item of the list)
to attach it to a mail message.

Note that your script must delete the PDF file after you have finished
working with it.

--
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.

  • Prev by Date: Re: Where is "osascript"?
  • Next by Date: filemaker open local htm helpfile
  • Previous by thread: Re: PDF Services - I'm lost...
  • Next by thread: PDF Services - I'm lost...
  • Index(es):
    • Date
    • Thread