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


Click here to return to the 'Am impressed! File naming' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Am impressed! File naming
Authored by: MtnBiker on Feb 20, '03 03:06:38AM

I'm impressed.

Is there a way to control the file naming. I want the attachment to have a descriptive name or the name of the file from which it was printed.

My most important use (at the moment, since I've just discovered this) is to convert a Word document for mailing a club newsletter. I have been printing to PDF and then attaching, but it's too easy to lose track of exactly which version one is sending out.

TIA

---
Hermosa Beach, CA USA



[ Reply to This | # ]
REVISED! File naming for Entourage
Authored by: MtnBiker on Feb 20, '03 03:09:30AM

Oops, I should have read the original script, it has this option.

But I really need it for Entourage, so can someone rewrite this for Entourage.

TIA

I couldn't find a way to revise my posting.

---
Hermosa Beach, CA USA



[ Reply to This | # ]
REVISED AGAIN! File naming for Entourage
Authored by: MtnBiker on Feb 20, '03 03:28:30AM

I'm afraid I have a mental block against AS
Below is the script for Mail-how to change for Entourage. I looked at both dictionaries, but don't see where the stuff for Mail comes from:
tell application "Mail"
set the new_message to ¬
(make new outgoing message with properties ¬
{visible:true, content:" "})
tell the new_message
tell content
make new attachment with properties ¬
{file name:target_file} at ¬
before the first character
end tell
end tell
end tell
-------
My previous posting were too hastily posted. It's way past time to get to bed. Thanks for any help

---
Hermosa Beach, CA USA



[ Reply to This | # ]
REVISED AGAIN! File naming for Entourage
Authored by: ewelch on Feb 21, '03 11:12:12PM

Entourage? That looks like the mail script. ;-)

---
--
Eric

Zen master to hotdog vendor. \"Make me one with everything.\"



[ Reply to This | # ]
REVISED AGAIN! File naming for Entourage
Authored by: swamiswami on Mar 07, '03 03:17:29PM
I couldn't get the script above to work in Entourage. Here's a script that seems to work for me:

on open these_items
	tell application "Finder"
		(*this part is to rename the PrintJob.pdf file*)
		repeat with aFile in these_items
			set a to the name of aFile
			display dialog "Enter file name for attachment" default answer a
			set the name of aFile to the text returned of result
		end repeat
	end tell
	
	
	tell application "Microsoft Entourage"
		set the new_message to (make new outgoing message with properties {attachment:{file:these_items}})
		open new_message
	end tell
end open


A few notes:
  • For some reason the dialog to rename the file doesn't come to the front automatically
  • Neither does the completed email message (although it is ready to go when you switch to Entourage)
  • I don't know why the repeat loop is needed since the print job should be a single file

Hope this helps someone.

-->Steve

[ Reply to This | # ]
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 | # ]
Am impressed! File naming IT WORKS!!
Authored by: acromac on Apr 25, '03 07:11:32AM

initial apple script work fine and lets you enter a file name for
the PDF you send via email.
The problem seem to be in apple script editor (may be a bug?)
when there is no blank line at the end of the script!
1 cut and past apple script source to the editor
2 add a blank line at the end
3 chek the script
4 save it as compiled at the right place (as indicated in apple
directives)
that's all folks

a man who switch recently



[ Reply to This | # ]