G’day John
It looks as though you’ve found a serious bug in El Capitans Mail.app
I thought at first your problem might have been your use of smart quotes, and lack of the ‘as rich text’ command, but replacing them made no difference.
The was a problem in Yosite in that if you created a subsidiary mailbox, then deleted it, then tried to re-create the subsidy mailbox, Mail.app refused until the top level mailbox was re-built.
I modified your code, but it still doesn’t work.
Anyone know an answer before I lodge a bug report. I also REALLY need this to work in El Capitan.
Regards
Santa
tell application "Mail"
activate
if not (exists mailbox "Bar") then make new mailbox with properties {name:"Bar"}
do shell script ("sleep 0.1")
set selected mailboxes of message viewer 1 to mailbox "Bar"
tell application "System Events" to tell process "Mail"
click menu bar item "Mailbox" of menu bar 1
do shell script ("sleep 0.1")
click menu item "Rebuild" of menu 1 of menu bar item "Mailbox" of menu bar 1
end tell
do shell script ("sleep 0.1")
if not (exists mailbox "Dandy" of mailbox "Bar") then
beep
repeat until exists mailbox "Dandy" of mailbox "Bar"
try
make new mailbox with properties {name:("Bar/Dandy" as rich text)}
end try
do shell script ("sleep 0.1")
end repeat # Loops indefinitely
end if
do shell script ("sleep 0.2")
if not (exists mailbox "Jim" of mailbox "Dandy" of mailbox "Bar") then
beep
try
make new mailbox with properties {name:"Bar/Dandy/Jim"}
on error errmsg
display dialog errmsg
end try
end if
end tell
On 8 Nov 2015, at 7:04 AM, John Mitchell <
email@hidden> wrote:
Scripters
I am trying to create a 3 hierarchy mail box
ie Bar>Dandy>Jim
tell application "Mail"
--tell account "On My Mac"
set mbox to make new mailbox with properties {name:"Bar"}
make new mailbox with properties {name:"Bar/Dandy"}
set selected mailboxes of message viewer 1 to {mailbox "Dandy" of mailbox "Bar"}
make new mailbox with properties {name:”Dandy/Jim”} - fails
make new mailbox at end of mailbox "Dandy" with properties {name:”Dandy/Jim”} - fails
make new mailbox with properties {name:”Bar/Dandy/Jim”} - fails
--end tell
end tell
Dany is correctly created, but Jim is not, for the above options
any advice?
regards
John
Email:
email@hidden • Mob: +61 410 318 131