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


Click here to return to the 'Not impressed!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Not impressed!
Authored by: frogmella on Feb 18, '03 11:43:18AM

I tried their example for making an email attachment, but it just crashes whichever application I was printing from!



[ Reply to This | # ]
Not impressed!
Authored by: bluehz on Feb 18, '03 11:47:29AM

Unfortunately - Apple has doen its usual "lets release a great technology and offer no support or docs for it" routine. The PDF crowd is REALLY excited about this though and many are furiously whipping up AS for use. Be on the lookout...



[ Reply to This | # ]
Not impressed!
Authored by: monickels on Feb 18, '03 12:02:39PM

Frogmella, where do you see these scripts being discussed? I'd like to see what others are doing before I duplicate their efforts...

---
<a href=http://www.worldnewyork.org>World New York</a>



[ Reply to This | # ]
Not impressed!
Authored by: Mr. X on Feb 18, '03 12:43:33PM

worked fine for me. Make sure you check the script (in script editor: click on the "check syntax") for typos. If you copy/paste from the HTML page, you might get a few formatting problems (I did :) like missing spaces, etc...



[ Reply to This | # ]
use alias of email program instead
Authored by: mclbruce on Feb 18, '03 04:50:23PM

There is no need to use the example script. Juat make an alias of your email program and put that in the PDF Services folder. You can name the alias whatever you want. This works for Entourage as well as Mail.app.



[ Reply to This | # ]
use alias of email program instead [not necessarily]
Authored by: richard_k_smith on Feb 18, '03 11:41:48PM
It is probably worth it to cut and paste the applescripts from the Apple Web site, and to correct the spacing errors that are somehow introduced int eh process, since you get the side benefit of having the new email message window pop up on your screen, as opposed to sitting in the background (although some may see that as a feature).

By the way, does anyone know how to have the "To:" field selected in the window? Sometimes it is (for example if you just drag a file to the Mail icon in the dock) but other times it isn't (for example if you ask Safari to email a selection using the services menu item).

If you're frustrated with the code that apple has posted and can't figure out how to get the spaces to work where you want them to, paste this into the Script Editor's "new script" window, and save as "Send via Mail" or something in the ~/Library/PDF Services folder:

on open these_items
	tell application "Mail"
		set the new_message to (make new outgoing message with properties {visible:true})
		tell the new_message
			tell content
				repeat with i from 1 to the count of these_items
					set this_file to item i of these_items
					make new attachment with properties {file name:this_file} at before the first character
				end repeat
			end tell
		end tell
	end tell
end open


[ Reply to This | # ]
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 | # ]