Sample Header Ad - 728x90

I am trying to create a script with a keyboard shortcut that will move the selected message in Mail to a specific folder

1 vote
0 answers
277 views
I have certain emails that come in from various sources, and I need to file them away for future reference. Yes, I can drag and drop it into the folder, but I would like to create a keyboard shortcut to do this more easily. This is my first attempt at Apple Scripts/Script editor. Here is the code I pieced together from several google searches to move the selected email. The end result is error "" number -1721. Running MacBook Pro (13 inch, M1) MacOS: Monterey 12.6 Mail: 16.0 Script Editor: 2.11 (227) AppleScript 2.8 Any suggestions and ideas are welcome. Thanks in advance!
on run {input, parameters}
	set target_account to "Gmail"
	set target_mailbox to "Inbox/Jobs"
	tell application "Mail"
		set theSelectedMessage to selection
		tell application "Mail"
			move the theMessage to mailbox target_mailbox of account target_account
		end tell
	end tell
	return input
end run
Asked by Kyddrivers (11 rep)
Sep 27, 2022, 03:26 PM