M
markus.hartbauer
Hi! I need to batch export my Entourage Mails to the filesystem. I've
created an AppleScript which does that but I'd rather export a PDF
Version of the Mail-Texts than the proprietary Entourage Files.
Can anyone please give me a hint how to use AppleScript to Save an
Entourage Message Item as PDF?
Thank you & Best regards,
M
FYI here is my Script - you may use it freely:
(*
max Exporter...
© 2008 max
*)
tell application "Microsoft Entourage"
activate
set theSelection to current messages
if theSelection is equal to {} then error "No message(s) selected!"
display dialog "Project:" default answer ""
set projekt to text returned of result
if projekt is equal to "" then error "No Project specified!"
set docFolder to (path to documents folder from user domain)
set fpath to (choose folder default location docFolder with prompt ¬
¬
"Select target folder" without multiple selections allowed) as
string
repeat with theMessage in theSelection
set messageDate to time received of theMessage
copy messageDate to b
set b's month to January
set messageYear to year of messageDate
set messageMonth to month of messageDate
set messageMonthNum to 1 + (messageDate - b) div 2500000
set messageDay to day of messageDate
set messageSubject to subject of theMessage
set messageSender to sender of theMessage
set messageSenderName to display name of messageSender
set newFname to "" as string
set fname to (subject of theMessage) as string
if ((count of characters of fname) > 40) then
set fname to ((characters 1 thru 37 of fname) & "...") as string
end if
set fname to projekt & " " & (messageYear as text) & (text -2 thru
-1 of ("00" & messageMonthNum)) & (text -2 thru -1 of ("00" &
messageDay)) & " " & (messageSenderName) & ": " & fname
if (fname contains ":") then
repeat with j in characters of fname
if (j as string = ":") then
set newFname to newFname & "-"
else
set newFname to newFname & j
end if
end repeat
set fname to newFname
end if
set fname to (fpath & fname) as string
tell application "Finder"
if (exists file (fname)) then
set k to 1
repeat while (exists file (fname & "-" & (k as string)))
set k to k + 1
end repeat
set fname to (fname & "-" & (k as string))
end if
end tell
save theMessage in fname
tell application "Finder"
update file fname
tell fpath
update every item with necessity
end tell
end tell
end repeat
end tell
created an AppleScript which does that but I'd rather export a PDF
Version of the Mail-Texts than the proprietary Entourage Files.
Can anyone please give me a hint how to use AppleScript to Save an
Entourage Message Item as PDF?
Thank you & Best regards,
M
FYI here is my Script - you may use it freely:
(*
max Exporter...
© 2008 max
*)
tell application "Microsoft Entourage"
activate
set theSelection to current messages
if theSelection is equal to {} then error "No message(s) selected!"
display dialog "Project:" default answer ""
set projekt to text returned of result
if projekt is equal to "" then error "No Project specified!"
set docFolder to (path to documents folder from user domain)
set fpath to (choose folder default location docFolder with prompt ¬
¬
"Select target folder" without multiple selections allowed) as
string
repeat with theMessage in theSelection
set messageDate to time received of theMessage
copy messageDate to b
set b's month to January
set messageYear to year of messageDate
set messageMonth to month of messageDate
set messageMonthNum to 1 + (messageDate - b) div 2500000
set messageDay to day of messageDate
set messageSubject to subject of theMessage
set messageSender to sender of theMessage
set messageSenderName to display name of messageSender
set newFname to "" as string
set fname to (subject of theMessage) as string
if ((count of characters of fname) > 40) then
set fname to ((characters 1 thru 37 of fname) & "...") as string
end if
set fname to projekt & " " & (messageYear as text) & (text -2 thru
-1 of ("00" & messageMonthNum)) & (text -2 thru -1 of ("00" &
messageDay)) & " " & (messageSenderName) & ": " & fname
if (fname contains ":") then
repeat with j in characters of fname
if (j as string = ":") then
set newFname to newFname & "-"
else
set newFname to newFname & j
end if
end repeat
set fname to newFname
end if
set fname to (fpath & fname) as string
tell application "Finder"
if (exists file (fname)) then
set k to 1
repeat while (exists file (fname & "-" & (k as string)))
set k to k + 1
end repeat
set fname to (fname & "-" & (k as string))
end if
end tell
save theMessage in fname
tell application "Finder"
update file fname
tell fpath
update every item with necessity
end tell
end tell
end repeat
end tell