I'm trying to write an applescript which will insert some predefined text at the beginning of a message. This is what I currently have:
set msgClass to (choose from list {"Green", "Blue", "Purple"} with title "Choose:")
if result is false then
stop
else
set msgClasstxt to the result
set msgClasstxt to "Classification: " & msgClasstxt
tell application "System Events"
key code 126 using {command down}
keystroke return
keystroke return
key code 126 using {command down}
end tell
tell application "Microsoft Outlook" to set selection to msgClasstxt
end if
I'm sure there's a better way to do this, but the intent is as follows:
- Go home w/CMD+Up
- Create two empty lines
- Go home again
- Insert text
My problem is that the text is being inserted BEFORE the keystrokes are performed. Vexing. Can anyone help?