Advertisement
Guest User

Untitled

a guest
Jun 11th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. on run {input, parameters}
  2.  tell application "System Events"
  3.  activate
  4.  
  5.  --BEGIN Config
  6.  --You should only need to edit these variables
  7.  set myAccount to "your.email@here"
  8.  set myMailAccounts to {"Inbox", "1 To-Do", "2 Wait", "3 Completed", "Archive"}
  9.  set myDefault to {"1 To-Do"}
  10.  --END Config
  11.  
  12.  choose from list myMailAccounts with title "Open Mailbox" with prompt "Choose Mailbox" default items myDefault
  13.  set selectedMailbox to result as string
  14.  end tell
  15.  
  16.  --Activate Mail in case the dialogue box was cancelled out of
  17.  tell application "Mail"
  18.  activate
  19.  end tell
  20.  
  21.  --loop through options and decide which mailbox was selected
  22.  repeat with i from 1 to count of myMailAccounts
  23.  set this_item to item i of myMailAccounts
  24.  
  25.  if selectedMailbox is this_item then tell application "Mail"
  26.  --if this mailbox was selected, open it
  27.  activate
  28.  set s to selection
  29.  repeat with eachMessage in s
  30.  move eachMessage to mailbox selectedMailbox of account myAccount
  31.  end repeat
  32.  end tell
  33.  end repeat
  34. end run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement