Mateo the Tech

Q: Creating Smart Mailbox in Apple Script

Hello,

 

I'm trying to write a scrip that will add a range between 5 and 40 mailboxes to a smart mailbox.  Here is what I have so far.  I know it doesn't work but let me know what I can do to get it to work.

 

set MailboxNames to {"Example, A"}

set MailboxNumber to 1

display dialog "What are the Mailbox's Names?" default answer ""

set MailboxNames to text returned of result

tell application "Mail" to activate

tell application "System Events"

  tell process "Mail"

  tell menu bar 1

  tell menu bar item "Mailbox"

  tell menu "Mailbox"

  click menu item "New Smart Mailbox…"

  end tell

  end tell

  end tell

  set Worklist to sheet 1 of window 1

  keystroke "Worklist"

  click ((pop up button 2) of Worklist)

  click menu item "any" of ((pop up button 2) of Worklist)

  click ((pop up button 3) of Worklist)

  click (menu item "Message is in mailbox") of pop up button 3 of Worklist

  click ((pop up button 4) of Worklist)

  click (menu item with title "Mail Sever") of pop up button 4 of Worklist

  click (menu item with title "A") of (menu item with title "Mail Sever") of pop up button 4 of Worklist

  click menu item "MailboxNames"

  click menu item with title  "add criterion" of Worklist

  end tell

end tell

MacBook Pro with Retina display, OS X El Capitan (10.11.5), null

Posted on Jun 2, 2016 5:25 PM