Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Not Working for Me' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Not Working for Me
Authored by: Graff on Feb 19, '03 08:36:17PM
    I would REALLY like to get a perl or shell script working, but no luck so far. And believe me, I've tried just about everything.
Well I thought that maybe you needed to name the script with a .sh extension so that the Finder knows to execute the script, but you don't need to. All you need to do is to make it executable with a "chmod +x filename" and the script will run just fine.

I made up this little shell script to test this:

#!/bin/sh
#
# Input parameter:
# $3 - path to the document's location as a temp file

mv "$3" ~/Desktop/


This moves the temp file created by the PDF Services to the current user's desktop. Not too useful since using an alias to the desktop works more easily than using a script. The important thing is to remember that the PDF services is creating a temp document, storing it somewhere, and passing the file name and path to the shell as the the third input parameter.

Go to this Apple documentation page for more info on creating PDF Workflow Options. Particularly interesting is this statement:
A UNIX tool or tool alias triggers an action by the tool on the PDF file. Tools are passed three parameters:
   • the title of the PDF document
   • a string that specifies the CUPS options for the job
   • the path to the spooled PDF file

This means that the name will be in the variable $1, the CUPS options will be in $2, and the file path will be in $3. Remember, since the file is in a temp directory you are responsible for cleaning it up, if you need to delete it (that is, your action on it didn't remove it from the temp directory) then just put this statement at the end of your script:

rm -f "$3"

[ Reply to This | # ]