Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- Manage GTD Projects within Entourage
- by Rich Corbridge
- If you enhance/extend this please drop me a copy at rich.corbridge AT gmail.com.
- *)
- tell application "Microsoft Entourage"
- -- get the currently selected task
- set theTasks to selection
- -- if there are no tasks selected, warn the user and then quit
- if theTasks is {} then
- display dialog "Please select a task first and then run this script." with icon 1
- return
- end if
- repeat with theTask in theTasks
- -- get the information from the message, and store it in variables
- set theName to name of theTask
- set theCategory to category of theTask
- set theProject to project list of theTask
- set thePriority to priority of theTask
- set theContent to content of theTask
- set theDueDate to due date of theTask
- set theLinks to links of theTask
- set Pos to offset of "] - " in theName
- set projectName to (text 1 thru Pos of theName)
- set lastAction to (text (Pos + 2) thru -1 of theName)
- set tempContent to theContent
- set foundAll to 0
- set actions to {}
- repeat until (foundAll = 1)
- set returnPos to offset of return in tempContent
- if returnPos = 0 or returnPos = 1 then
- set foundAll to 1
- else
- set tempAction to (text 1 thru (returnPos - 1) of tempContent)
- set actions to actions & tempAction
- if (returnPos + 1) < (length of tempContent) then
- set tempContent to (text (returnPos + 1) thru (length of tempContent) of tempContent)
- else
- set foundAll to 1
- end if
- end if
- end repeat
- set actionsCount to count of actions
- set nextActionText to ""
- if actionsCount is greater than 0 then
- repeat with i from 1 to actionsCount
- if item i of actions = lastAction and i + 1 ² actionsCount then
- set nextActionText to item (i + 1) of actions
- end if
- end repeat
- end if
- if nextActionText > "" then
- set nextAction to projectName & " " & nextActionText
- -- create a new task with the information from the old task and the next action
- set newTask to make new task with properties {name:nextAction, content:theContent, category:theCategory, project list:theProject, priority:thePriority, due date:theDueDate}
- set theLinksCount to count of theLinks
- if theLinksCount is greater than 0 then
- -- open newTask to add link
- open newTask
- display dialog "There were some links that couldn't be carried over."
- end if
- end if
- set theTask's completed to true -- set the old Task to complete
- end repeat
- end tell
Add Comment
Please, Sign In to add comment