Title: Re: templates
[final version of templates script that allows attachments]


From: "R. Scott Ohlgren" <[EMAIL PROTECTED]>
Date: Fri, 03 Nov 2000 16:27:19 -0700

Awesome. Works with Unsent Drafts (dragged from the Drafts folder), already sent, deleted, and incoming messages. It includes any and all attachments, and places the cursor in the �To� field.

Amazing! This is bar none the most useful script I use.


Great, glad it worked out.

(Really, the credit goes to Dan Crevier, who built the duplicate/redirect functionality into 'rage AS in the first place, and Paul B.  Of course.)

- B


****************************************************************************

-- Open Template 1.1
-- script by Bryan Harris, [EMAIL PROTECTED], 3 November 2000

--
This script prompts the user to select any message
-- from the "TEMPLATE" folder (at the root folder level)
-- to be used as a custom template/stationery.

-- The "TEMPLATE" folder is created by the user at the root folder
-- level, and there is no restriction on the type of message
-- put there (draft, incoming/outgoing, sent/unsent ok).



tell application "Microsoft Entourage"
  
  activate
  
  with timeout of 600 seconds
      
      try
           set theMsgs to (every message of folder "TEMPLATES")
      on error
           display dialog "Can't find a \"TEMPLATES\" folder.  This script requires that there be a folder named \"TEMPLATES\" at the root folder level with messages in it to be used as templates." with icon stop
          return
       end try
       
      set theCount to count of theMsgs
      
      if theCount is 0 then
           display dialog "There are no templates in the \"TEMPLATES\" folder.  Please drag at least one message to that folder to use this script.  (Holding down the \"Option\" key while dragging will place a copy of the message.)" with icon stop
          return
       end if
       
      set theSubs to {}
      
      repeat with i1 from 1 to theCount
          set theSubs to theSubs & (i1 & ".  " & subject of (item i1 of theMsgs) as string)
      end repeat
       
      set theTemp to (choose from list theSubs with prompt "Select a template:" without multiple selections allowed and empty selection allowed) as string
      
      set i2 to ((characters 1 through ((offset of "." in theTemp) - 1) of theTemp) as string) as integer
      
      set theMsg to item i2 of theMsgs
      
      try
           if (class of theMsg is incoming message) or (delivery status of theMsg is sent) then
               set newMsg to (redirect theMsg)
           else
               set newMsg to (duplicate theMsg to drafts folder)
              open the newMsg
          end if
       on error
           display dialog "Script error 2.  Please notify Bryan Harris, [EMAIL PROTECTED], of the circumstances leading to this error."
      end try
       
  end timeout
   
end tell


****************************************************************************


Reply via email to