Advertisement
Guest User

Import To Hit List.scpt

a guest
Dec 8th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. tell application "Mail"
  2.     try
  3.         set theSelection to the selection
  4.         if the length of theSelection is less than 1 then
  5.             my notifyGrowl("Fail Importing Mail Message", "No messages are selected", "Not Imported")
  6.         end if
  7.         repeat with theMessage in theSelection
  8.             my importMessage(theMessage)
  9.         end repeat
  10.     end try
  11.     my notifyGrowl("Imported Mail Message", subject of theMessage, "Imported")
  12. end tell
  13.  
  14. on importMessage(theMessage)
  15.     tell application "Mail"
  16.         try
  17.             set theSubject to subject of theMessage
  18.             set theDate to date received of theMessage
  19.             set messageURL to "Task created from mail message:%3c" & (message id of theMessage) & "%3e"
  20.             set theBody to messageURL & return & return & the content of theMessage
  21.             tell application "The Hit List"
  22.                 tell inbox to make new task with properties {timing task:theSubject, notes:theBody, start date:theDate}
  23.             end tell
  24.         end try
  25.     end tell
  26. end importMessage
  27.  
  28.  
  29. on notifyGrowl(theTitle, theMessage, theName)
  30.    
  31.     tell application "System Events"
  32.         set isRunning to (count of (every process whose bundle identifier is "com.Growl.GrowlHelperApp")) > 0
  33.     end tell
  34.    
  35.     if isRunning then
  36.         tell application id "com.Growl.GrowlHelperApp"
  37.             --       Send a Notification...
  38.             notify with name theName title theTitle description theMessage application name "The Hit List Mail Capture Script"
  39.         end tell
  40.     end if
  41. end notifyGrowl
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement