• 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: problem with a mail.app script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with a mail.app script


  • Subject: Re: problem with a mail.app script
  • From: Kim Holburn <email@hidden>
  • Date: Wed, 14 Apr 2004 13:17:23 +1000

On 2004 Apr 12, , at 5:53 AM, BJ Terry wrote:

On Apr 10, 2004, at 4:16 PM, Kim Holburn wrote:

I am trying to write a mail.app rule script that opens a new window when I get mail moved to a mailbox.

None of these do anything. I get a new message viewer window but the script can never select a mailbox. Anyone have any hints?


--
Kim Holburn

On my computer, if I run the following script:

tell application "Mail"
set theWindow to make new message viewer with properties {visible:true}
set selected mailboxes of theWindow to {mailbox "myMailbox"}
end tell

It won't select the mailbox. But if I add a delay of 1 second before setting the mailbox, like so:

tell application "Mail"
set theWindow to make new message viewer with properties {visible:true}
delay 1
set selected mailboxes of theWindow to {mailbox "cal_acacia_spring04"}
end tell

This works fine with just one rule applied to one message but when I get 50 - 100 messages with say 50 rules going to say 20 mailboxes and trying to open 20 windows things go a bit pear-shaped. I get 3 or 4 blank windows with no mailbox selected.

I put in a loop to try the delay 10 times and eventually throw up a dialog box after 10 seconds. This made the situation worse although I got almost no blank windows.

I have now changed it to a loop that doubles the delay for each of 4 repeats if the selected mailbox hasn't taken.

I am interested to know what "delay" actually does. Does it put that process or thread to sleep for a while or does it poll in a loop? If I did "do shell script sleep 1" would that put the whole of mail to sleep and effectively mess up the window drawing anyway?




it works fine. The window isn't really ready to receive a new selection when it first opens, you just have to give it a second.

BJ Terry
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


--
Kim Holburn
IT Manager, Canberra Research Laboratory
National Information and Communication Technology Australia
Ph: +61 2 61258620 M: +61 0417820641
Email: email@hidden - PGP Public Key on request

Life is complex - It has real and imaginary parts.
Andrea Leistra (rec.arts.sf.written.Robert-jordan)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: problem with a mail.app script
      • From: BJ Terry <email@hidden>
References: 
 >problem with a mail.app script (From: Kim Holburn <email@hidden>)
 >Re: problem with a mail.app script (From: BJ Terry <email@hidden>)

  • Prev by Date: Re: Script Objects, Inheritance and Delegation
  • Next by Date: Re: problem with a mail.app script
  • Previous by thread: Re: problem with a mail.app script
  • Next by thread: Re: problem with a mail.app script
  • Index(es):
    • Date
    • Thread