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


Click here to return to the 'Shell Script with a slightly better file name' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Shell Script with a slightly better file name
Authored by: googoo on Feb 20, '03 10:17:17AM

Here is a shell script I wrote to send the PDF via Mail.app with a less cryptic filename (attachment.pdf). The script creates a copy of the PDF file with the new name and uses osascript to tell Mail.app to create a new message with the attachment. I bet that there is a better way to do this, though. (Maybe someone will post it here!)

-Mark

#!/bin/sh
aname=`dirname "$3"`/attachment.pdf
#set aname=/tmp/attachment.pdf
cp "$3" ${aname}

osascript << EOF
tell application "Mail"
set the new_message to (make new outgoing message with properties {visible:true})
tell the new_message
tell content
set theItem to (POSIX file "${aname}") as file
make new attachment with properties {file name:theItem} at before the first character
end tell
end tell
activate
end tell
EOF

rm ${aname}



[ Reply to This | # ]
Shell Script with a slightly better file name
Authored by: googoo on Feb 20, '03 10:25:10AM

It looks like I forgot to remove a line that I commented testing out the script posted above. You can omit the following line in the script posted above.

#set aname=/tmp/attachment.pdf

Or you can leave it in. It does nothing because it is a comment. Sorry for any confusion.

-Mark



[ Reply to This | # ]
Shell Script with a slightly better file name
Authored by: Thomas Kaiser on Mar 20, '03 05:20:07PM
Why not using the document title? The PDF Services provide you with
almost all the CUPS options, when working in the shell, so it's an easy
one.

I wrote a small CUPS backend to directly save into PS or PDF files and
use the CUPS options to redefine them into environment variables.
Maybe it's worth a look:

    http://user s.phg-online.de/tk/MOSXS/postscriptfile.gz

Regards,

Thomas

[ Reply to This | # ]