Hi - I would like to create a macro that copies the text from an email subject line and pastes it into a text string. Not sure how to get the subject or set up the text.
I’m using MS Outlook 2016 for Mac.
Like this:
Subject: Invoice 94215 for October 2015 (this is something I would type into the subject of a new email)
“Please find attached [subject line text]. Please confirm receipt by reply email and let us know if you have any questions”
HI Chris - this might be basic, but I can’t see the end of the applescript text due to the scroll bar after the ddButton line. is it just “end try”?? thanks
Right, I got that. But you see the subject is missing from the text - it wasn’t picked up. In this example, the subject is “Invoice 330040 March 2016”, so would expect the text string to be:
“Please find attached Invoice 330040 March 2016. Please confirm receipt by reply email and let us know if you have any questions.”
…also, would it be simpler to just set the subject variable and then insert text by pasting action with the variable?
Run this from the Script Editor.app and see if it works.
It sort of works in Outlook 2011 but has a glitch.
------------------------------------------------------------
# AppleScript
# Set body of front draft message to its subject.
------------------------------------------------------------
tell application "Microsoft Outlook"
tell front draft window
save
tell its object
set its content to (get its subject)
set msgID to its id
end tell
save
end tell
end tell
------------------------------------------------------------
If it doesn’t work run this script from the Script Editor.app.
------------------------------------------------------------
# AppleScript
# Set body of front draft message to its subject.
------------------------------------------------------------
tell application "Microsoft Outlook"
tell front draft window
save
tell its object
set its content to (get its subject)
set msgID to its id
end tell
save
delay 0.1
close
end tell
open outgoing message id msgID of drafts
end tell
------------------------------------------------------------
We’ll see if either one work with Outlook 2016 and then decide what to do.
Thanks Chris, I’ll give these a try later today. Was also thinking maybe a way to make this much more simple is to just copy the subject to the clipboard manually then have a script to paste the text with the clipboard text.
manually type subject, highlight and copy to clipboard
manually put cursor in message body, press hotkey to paste text with subject (from the clipboard) in the correct place.
Well okay! That works perfectly, thanks Chris, another example of the awesomeness of KBM AND the forum. Thanks again, really do appreciate the help. This will be the basis of several tedious repeating tasks!