Greetings -
I am an unsophisticated user of automation that has gotten lucky over the years in finding AppleScripts that have done a crucial workflow for me - creating a task in Things with a URL that opens a specific Outlook message. As versions of MacOS and Outlook have changed, I've had to adapt, but not by knowing how it all works, but getting lucky and Googling something that does. With a new M1 Mac and the latest updates to Automator I appear to be at a dead end.
What I'd like is for Alfred to be able to run the following script successfully. Whenever I try to do it by copying and pasting the below into an NSAScript object in a workflow, it basically does nothing at all. I suspect I'm one or two tips away from getting this previously successful script to work, but I don't know how. In my old setup I used this script to create a service in MacOS, now I can't. I'm hoping Alfred can help me bridge the gap but I don't know how to do it. Any assistance would be appreciated.
on run {input, parameters}
tell application "Microsoft Outlook"
set selectedMessages to selected objects
if selectedMessages is {} then
display notification "Please select a message in Outlook before running the script!"
else
set messageId to id of item 1 of selectedMessages
set uri to "outlook://" & messageId
set theSubject to the subject of item 1 of selectedMessages
set theSender to the sender of item 1 of selectedMessages
set theName to the name of theSender
end if
end tell
tell application "Things3"
show quick entry panel with properties {name:theSubject, notes:"From: " & theName & return & "Subject: " & theSubject & return & "Link: " & uri}
end tell
return input
end run