• 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: Scripting mail create a mailbox in a mailbox (folder)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting mail create a mailbox in a mailbox (folder)


  • Subject: Re: Scripting mail create a mailbox in a mailbox (folder)
  • From: John Mitchell <email@hidden>
  • Date: Thu, 14 Jul 2005 17:28:32 +1000

Title: Re: Scripting mail create a mailbox in a mailbox (folder)
Matt

I was helped by Paul Berkowitz (I think)  with this; I think it works :-{

        if emailApp is "Mail" then
             
tell application "Mail"
               
if not (exists mailbox mailBoxName of mailbox thismailFolder) then
                             
try
                                     --
format for mailbox sub-mailboxes is to name the hierarchy using "/"s as delimeter
                                   
set folderRef to (make new mailbox at beginning ¬
                                              
with properties {name:thismailFolder & "/" & mailBoxName})
                             
on error
                                       
display dialog "Cannot make new mailbox " & mailBoxName & "(Mail)"
                                     
return {false, boxExists}
                              
end try
               
else
                           
display dialog "Mailbox <" & mailBoxName & "> " & return & ¬
                                    "already exists in mail folder " &
return & ¬
                                   "<" &
thismailFolder & "> " buttons {"Continue"} default button "Continue"
                             
set boxExists to true
                  
end if
         
end tell
       
end if




At 12:49 AM -0700 13/7/05, Matt Petrowsky wrote:
It just so happens that I'm trying to write a script to do the same thing. Unfortunately, I don't think it can be done at this time - at least upon first impression. When you look at the properties listing in the Mail dictionary you'll see that the container: property is [r/o] - meaning Read only.

Attempting to create then move doesn't work either. Such as the following.

make new mailbox with properties {name:"foo"}
move mailbox "foo" to mailbox "bar"

Anyone on the list having success with creating a folder within a folder in Apple Mail?

Matt


On Jan 8, 2005, at 9:14 AM, John Mitchell wrote:

In Mail I use this routine to create a Mailbox (actually, functionally  a mail folder)

                tell application "Mail"
                try
                             make new mailbox at beginning with properties {name:newMailFolder}
                      on error errMsg number errNum
                           display dialog "Could not create new category folder <" & newMailFolder & "> (Mail)" & return ¬
                                & errMsg buttons {"Quit"} default button 1
                              return {false}
                  end try
        end tell

eg
set {flag} to createMailFolder("Mail", "", "Babble") of me

 this works; however when I try to make a mailbox in it, using this routine:

                tell application "Mail"
                        if not (exists mailbox mailBoxName of mailbox thismailFolder) then
                                try
                                        set folderRef to (make new mailbox at beginning of mailbox thismailFolder ¬
                                                with properties {name:mailBoxName})
                                on error
                                        display dialog "Cannot make new mailbox " & mailBoxName & "(Mail)"
                                        return {false, boxExists}
                                end try
                        else
                                display dialog "Mailbox <" & mailBoxName & "> already exists" & return ¬
                                        & "in mail folder " & thismailFolder buttons {"Continue"} default button "Continue"
                                set boxExists to true
                        end if
                end tell

eg set {flag, folderRef} to createMailBox("Mail", "", "Projects", "Headquarters") of me

there is no error message but nothing is created. This same result happens if I modify the createMailFolder routine to create a mailbox inside a Mailbox.

 If the mailbox exists it behaves correctly, ie it finds the mailbox in the mailbox

any clues?

--
regards


John
--------------------------------------------------------------------------------------------------------------------------------------------
John Mitchell, Director, IFC Interoperability, Graphisoft R&D Rt
11 Terrell Avenue, Wahroonga, NSW 2076 Australia
Email:  email@hidden
Tel: +61 (2) 9489 3785 ¤ Fax: +61 (2) 9489 4035 ¤ Mob:+61 410 318 131
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
>oductions.com

This email sent to email@hidden


--
regards


John
-------------------------------------------------------------------------
CQR Pty Ltd
11 Terrell Avenue, Wahroonga, NSW 2076 Australia
Email:  email@hidden € Mob:+61 410 318 131
Skype:jrmitchell    
Tel: +61 (2) 9489 3785 € Fax: +61 (2) 9489 4035
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Scripting mail create a mailbox in a mailbox (folder) (From: Matt Petrowsky <email@hidden>)

  • Prev by Date: satimage: how to change using regexp, returning the whole string
  • Next by Date: Re: Tiger Desktop Position of Disks
  • Previous by thread: Re: Scripting mail create a mailbox in a mailbox (folder)
  • Next by thread: Re: Scripting mail create a mailbox in a mailbox (folder)
  • Index(es):
    • Date
    • Thread