• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: applescripting sub mailboxes in Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescripting sub mailboxes in Mail


  • Subject: Re: applescripting sub mailboxes in Mail
  • From: Brian Christmas <email@hidden>
  • Date: Tue, 17 Nov 2015 13:10:35 +1100

To all

I’ve amended and enhanced the code I’ll post to the Engineers. Any testers welcome, please.

Regards

Santa

tell application "Mail"
activate
try
delete mailbox "Year 2016"
delete mailbox "Year 2017"
say "Mail boxes year 2016, 2017 deleted"
end try
try
make new mailbox with properties {name:"Year 2016"}
say "Mail box Year 2016 created."
on error errmsg
say "Mail box 2016 try one failed to be created"
end try
try
make new mailbox at beginning of mailboxes of mailbox "On My Mac/Year 2016" with properties {name:"Year 2016/11"}
say "Mail box Year 2016 created, sub mailbox 11 created"
on error errmsg
say "Mail box 2016 11 try 2 failed to be created"
end try
try
make new mailbox at beginning of mailboxes of mailbox "Year 2016" with properties {name:"Year 2016/11"}
say "Mail box Year 2016 created, sub mailbox 11 created"
on error errmsg
say "Mail box 2016 11 try 3 failed to be created"
end try
try
make new mailbox at mailbox "Year 2016" with properties {name:"Year 2016/11"}
say "Mail box Year 2016 created, sub mailbox 11 created"
on error errmsg
say "Mail box 2016 11 try 4 failed to be created"
end try
try
make new mailbox with properties {name:"Year 2016/11"}
say "Mail box Year 2016 created, sub mailbox 11 created"
on error errmsg
say "Mail box 2016 11 try 5 failed to be created"
end try
try
make new mailbox at beginning of mailboxes of mailbox "Year 2016/11" with properties {"2016 11 17"}
on error errmsg
say "Mail box 2016 11 17 try 6 failed to be created"
end try
end tell
tell application "Mail"
activate
try
delete mailbox "Year 2016"
say "Mail box year 2016 deleted"
end try
try
make new mailbox with properties {name:"Year 2016/"}
say "Mail box Year 2016 with slash created."
on error errmsg
say "Mail box 2016 try 7 failed to be created"
end try
try
make new mailbox with properties {name:"Year 2016/11/"}
say "Mail box Year 2016 with slash created, sub mailbox 11 with slash created"
on error errmsg
say "Mail box 2016 11 try 8 failed to be created"
end try
try
make new mailbox with properties {name:"Year 2016/11/17/"} # FAILS
say "Mail box Year 2016 created, sub mailbox 11 created, sub mailbox 2016 11 17 with slash created"
on error errmsg
say "Mail box 2016 11 17 try 9 failed to be created"
end try
try
make new mailbox with properties {name:"Year 2017/12/17/"}
say "Mail box Year 2017 created, sub mailbox 12 created, sub mailbox 2017 12 17 with slash created"
on error errmsg
say "Mail box 2017 12 17 try 10 failed to be created"
end try
end tell

On 17 Nov 2015, at 11:46 AM, Stockly, Ed <email@hidden> wrote:

In a quick glance it looks like you’ve got the property spec wrong. 

I didn’t fix and test the other versions, but it looks the same in them.

Or, am I missing something? (Haven’t been following the thread, that closely, but I’m going to be scripting Mail this week…)



tell application "Mail"
activate
try
--make new mailbox with properties "Year 2016” — doesn’t work

make new mailbox with properties {name:"Year 2016”}— works
say "Mail box Year 2016 created."
on error errmsg
say "Mail box 2016 try one failed to be created"
end try
end tell



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: applescripting sub mailboxes in Mail
      • From: Yvan KOENIG <email@hidden>
References: 
 >Re: applescripting sub mailboxes in Mail (From: Brian Christmas <email@hidden>)
 >Fwd: applescripting sub mailboxes in Mail (From: Brian Christmas <email@hidden>)
 >Re: applescripting sub mailboxes in Mail (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: applescripting sub mailboxes in Mail
  • Next by Date: Re: applescripting sub mailboxes in Mail
  • Previous by thread: Re: applescripting sub mailboxes in Mail
  • Next by thread: Re: applescripting sub mailboxes in Mail
  • Index(es):
    • Date
    • Thread