Here's an applescript to attach current Nisus doc to email.

Have a problem? A question? This is the place for answers from other Express users.
Post Reply
soulbarn
Posts: 25
Joined: 2006-05-15 11:04:37

Here's an applescript to attach current Nisus doc to email.

Post by soulbarn »

maybe there's already a way to do this, but I couldn't find it. I was trying to do this myself, but got MAJOR help from the forum users at macosxhints.com...please include the credit (not mine, the author's) if you distribute it:


-- Send Nisus Writer Express Document as Mail Attachment
--
-- By BigPixel Software
-- http://bigpixel.macintoshdevelopers.net
-- You don't have t keep this header here, but if you do
-- redistrbute it, I would like some credit for my work.

tell application "Nisus Writer Express"
set theFile to path of document of front window
end tell
tell application "Mail"
set theMessage to make outgoing message
tell theMessage
make new attachment with properties {file name:theFile} at after the last paragraph
end tell
set visible of theMessage to true
end tell

martin
Official Nisus Person
Posts: 4693
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Post by martin »

Thanks for posting this script. I tried it and it works just fine.

Not exactly the same, but there is another way to email content from within Express. Select the text you'd like to email and choose the menu Nisus Writer Express > Services > Mail > Send Selection. Just thought I'd mention it as another option.

soulbarn
Posts: 25
Joined: 2006-05-15 11:04:37

Post by soulbarn »

BTW, if you want the script to activate mail, with the new message opened and ready to address, add these lines to the end of the script:

tell application "Mail"
activate
end tell

marc
Posts: 83
Joined: 2004-07-06 08:45:15
Location: Australia
Contact:

Post by marc »

Thanks to soulbarn for this handy script! :)

Most of the time, I tend to use the Mail PDF 'PDF service' via the Print dialogue, mainly to avoid sending editable documents, but this is very handy if you do want to send the RTF.

As such, I've made a tiny modification; I've moved the 'activate Mail' instruction, to better ensure that the new email is always the foremost window (I tend to have multiple windows open in Mail, and the previous tweak would bring Mail to the front, after the new message was set as 'visible', and for me that meant it was rarely the front window):

Code: Select all

tell application "Nisus Writer Express"
	set theFile to path of document of front window
end tell
tell application "Mail"
	set theMessage to make outgoing message
	tell theMessage
		make new attachment with properties {file name:theFile} at after the last paragraph
	end tell
	activate
	set visible of theMessage to true
end tell

Post Reply