Hi Everyone
I am tring to combine two scripts together but am having real difficulty. Can someone help me?
The scripts are:
property RefNr : 0
property senderName : "John Doe"
property senderAddress : "john@doe.com"
set RefNr to RefNr + 1
tell application "Microsoft Entourage"
tell (make new outgoing message with properties {subject:"Ref: GT" & (text -4 thru -1 of ("0000" & RefNr)) & " - "})
set sender to {address:senderAddress, display name:senderName}
open
end tell
end tell
property msgID : 0
tell application "Microsoft Entourage"
if msgID ≠0 then
try
set msgTemplate to message id msgID
on error
beep
display dialog "! You must have either done a complex rebuild of Entourage recently or deleted your message template." & return & return & "Select your template and run the Message template script again to reset it." buttons {"OK"} default button "OK" with icon 2
set msgID to 0
return
end try
else
try
set sel to current messages
set msgTemplate to item 1 of sel
if (count of sel) ≠1 or class of msgTemplate ≠outgoing message or delivery status of msgTemplate ≠unsent then error number -128
set folderID to ID of storage of msgTemplate
set isLocal to my GetUrFolder(folderID)
if not isLocal then return
on error
beep
display dialog "! You must select just one unsent, saved draft message as your message template in a LOCAL folder [\"On My Computer\"]." & return & return & "Do so, and run the script again." buttons {"OK"} default button "OK" with icon 2 --
return
end try
display dialog "Do you want to save your template as UNSENT, allowing you to alter it but always showing as bolded in its folder, or as a SENT message, unbolded but unalterable?" buttons {" Cancel ", " Sent ", " Unsent "} default button 3 with icon 1
if button returned of result = " Cancel " then
return
else if button returned of result = " Sent " then
set delivery status of msgTemplate to sent
end if
set msgID to ID of msgTemplate
display dialog "All set up!" & return & return & "Do you want to write a new email message with your template right now?" buttons {"Not Now", "Open New Message"} default button 2 with icon 1
if button returned of result = "Not Now" then return
end if
set folderID to ID of storage of msgTemplate
set isLocal to my GetUrFolder(folderID)
if not isLocal then return
--if doesn't quit then all is OK
set newMsg to duplicate msgTemplate --message id msgID
move newMsg to drafts folder
open newMsg
end tell
on GetUrFolder(someID)
local theParent, parentID, isTrue
tell application "Microsoft Entourage"
try
set theParent to parent of folder id someID
if class of theParent = folder then
set parentID to ID of theParent
set isTrue to my GetUrFolder(parentID)
if not isTrue then return false
else if {class of theParent} is in {IMAP account, Hotmail account} then
beep
display dialog "! You must leave your message template in a LOCAL folder [\"On My Computer\"] for this script to work." & return & return & "Move or copy it to a local folder (Drafts folder or another), select it there, and run the script once to set it up again." buttons {" Cancel "} default button 1 with icon 0
set my msgID to 0
return false
end if -- parent must be Entourage, folder is top-level
on error -- parent must be Entourage, folder is top-level
return true
end try
end tell
return true
end GetUrFolder