Print email message with list of attachments

E

Elvis

Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Email Client: pop I have downloaded the script by Paul Berkowitz and modified it according to instructions in an old post on this forum so that the list of attachments prints at the top of the message.

I want to be able to print only one page of the email, however, which doesn't seem possible as this script sends the message straight to the printer without opening the normal printer driver window.

Can anyone help?
 
W

William Smith [MVP]

I have downloaded the script by Paul Berkowitz and modified it
according to instructions in an old post on this forum so that the
list of attachments prints at the top of the message.

I want to be able to print only one page of the email, however, which
doesn't seem possible as this script sends the message straight to
the printer without opening the normal printer driver window.

I thought this sounded familiar.

The script change I mention here
<http://groups.google.com/group/micr...tourage/browse_thread/thread/796d6a8db5223744>
or <http://tinyurl.com/yb466zk> does include a "from page 1 to 1" change
for the script.

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
E

Elvis

Thanks Bill, that is a great help. I now have two scripts - one to print the first page and a second to print all pages.

Is there any way of modifying the script so that it brings up the print preferences box instead of sending the document straight to the printer?

Thanks again!
 
W

William Smith [MVP]

Thanks Bill, that is a great help. I now have two scripts - one to
print the first page and a second to print all pages.

Is there any way of modifying the script so that it brings up the
print preferences box instead of sending the document straight to the
printer?

According to the AppleScript dictionary in Entourage, yes.

Change:

print newMsg

to

print newMsg print dialog true

Hope this helps!

--

bill

Entourage Help Page <http://entourage.mvps.org/>
Entourage Help Blog <http://blog.entourage.mvps.org/>
YouTalk <http://nine.pairlist.net/mailman/listinfo/youtalk>
Twitter: follow <http://twitter.com/meck>
 
Joined
Dec 14, 2012
Messages
1
Reaction score
0
Entourage with attachment lists

There are a lot of requests for this and none of the solutions seemed to work properly. With no experience of Applescript I have modified the popular Lutz Meyer / LuMe96(at)gmail.com version so that it works. We generally use this 'print page one only' version. You will need to compile this in Applescript. If you want to print all pages of the email remove the following code which appears near the end 'with properties {starting page:1, ending page:1}' My version will also print the first page only and show zero attachments if there were none. It also prints the email address of the sender above the attachment list.

(*

------------------------
-- INTRODUCTION --
------------------------

Applescript to print the selected Outlook messages
with a list of the files attached to that message.


v 0.1 - 22nd of February 2011
- initial release

v 0.2 - 27th of April 2012
- adaption for release

v 0.3 - 27th of April 2012
- option to print attachment list at top or bottom
- changed HTML line feed from <br> to <br/>

v 0.4 - 27th of April 2012
- corrected header for incoming messages


Written by Lutz Meyer / LuMe96(at)gmail.com updated by WillowsMagic

Donations via PayPal to LuMe96(at)gmail.com highly appreciated

*)

-- set to :
-- 0 for printing attachment list at the end
-- 1 for printing attachment list at the top


set ptyPrintAttachListatTop to 1

tell application "Microsoft Entourage"


-- get the selected messages
set selectedMessages to current messages

-- we check the number of selected messages
-- and exit if inf to 1
set msgCount to count selectedMessages
if (msgCount < 1) then
display dialog "No Message selected" buttons {"Close"} default button 1 with icon 0
return
end if


-- looping through the selected messages
repeat with theMessage in selectedMessages

set theSender to address of sender of theMessage
set theName to display name of sender of theMessage


-- copy the source of the message to be printed
set theSource to source of theMessage

-- check if the message is incoming or sent message
-- and change sender accordingly if incoming
--set theHeader to headers of theMessage
--if (theHeader contains "Received: from") then
-- set theSender to sender of theMessage
-- set sender of theNewMessage to theSender
--end if

-- create a new temp outgoing message just for printing based on the message source
set theNewMessage to make new outgoing message with properties {source:theSource}


-- init some vars
set attachCount to 0
set attachList to ""
set attachName to ""
set theAttachment to ""
set theAttachments to ""


-- set the appropriate line feed depending on message format
if (has html of theMessage is true) then
set theNewLine to "<br/>"
else
set theNewLine to linefeed
end if



-- check for existing attachments
--if ((count (attachments of theMessage)) > 0) then

-- get attachments
set theAttachments to (every attachment of theMessage)

-- loop through attachments
repeat with theAttachment in theAttachments

-- get the name of the attachment
set attachName to (name of theAttachment)

-- add the attachment name to the list of attachments if it is not a "Preview.app Document"
-- and increase the message count
if (".app Document" is not in attachName) then
set attachList to attachList & " - " & (name of theAttachment) & return
set attachCount to attachCount + 1
end if

end repeat

-- add a separator and a header line to the list of attachments
set attachList to return & "Email from " & theSender & " (" & theName & ")" & return & "========================================================" & return & attachCount & " Attachment(s) :" & return & attachList & "========================================================" & return

-- if the number of attachments is greater than 0
-- add the list of attachments to the message body
--if (attachCount > 0) then
if (ptyPrintAttachListatTop is 1) then
set (content of theNewMessage) to (attachList & (content of theNewMessage))
else
set (content of theNewMessage) to ((content of theNewMessage) & attachList)

end if
--end if
--end if

-- print the message
-- print theNewMessage


print theNewMessage with properties {starting page:1, ending page:1}
delete theNewMessage
delete theNewMessage

end repeat
end tell
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top