realbasic-nug
[Top] [All Lists]

Re: Looping, threads and Applescript

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Looping, threads and Applescript
From: Michael <mdeh at comcast dot net>
Date: Thu, 31 Jan 2008 20:37:16 -0800
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <AF0A2437-ABE6-4AA5-BA42-B15D73D33A8E at comcast dot net> <50D1C276-EA47-4206-97CE-7244FEB51A2B at sentman dot com>
On Jan 31, 2008, at 1:41 PM, James Sentman wrote:

>>
>>
>> I have one design issue that I am sure will cause some to say **
>> ouch**, but it **seems** to work. In order to give the user a chance
>> to cancel a part of the program, (with the sorting etc carried out in
>> a thread, I set a timer in a non-thread class ( to single mode) which
>> triggers a Dialog, then suspend the thread. The period for the Timer
>> seems long enough that the suspended thread occurs before the Dialog.
>> If there are other ways to do this, then I would like to hear those.
>> BTW...polling the thread is a great technique and works great.  A  
>> huge
>> downside of this approach is that the duplicate mails are moved by RB
>> and are placed in a folder that Mail does not know about. Rebuilding
>> Mail is easy, but not elegant.
>
> I can't exactly picture what is happening here, but a dialog to cancel
> a long winded operation isn't that uncommon a requirement. I would
> just let the thread loop as is necessary but every check through the
> loop check a global or other variable like "TheUserHasCancelled as
> boolean" and if that turns to true then stop what you're doing.


Well...it was really more to ask the user for input...kind of a Go/No  
go situation.  Go means move the files found, vs not.  Then  loop and  
repeat for the next mailbox.


>
>
>>
>>
>> Next issue regards another approach. It is possible to use  
>> AppleScript
>> in a loop to move e-mails within Mail. But the loop seems to  
>> "outpace"
>> Mail's ability to respond, or perhaps AppleScript ability to help. So
>> has anyone else experienced this. If so, can one "Slow down" the  
>> loop?
>> Perhaps feedback from Mail that an action has occured.
>>
>
> An applescript should wait for the app being scripted to finish the
> command before moving onto the next command.

I am using RB ( with MBS plugin) to send AS commands to Mail in a  
loop. That's why I thought it might be that the loop simply outpaced  
the ability of Mail to respond, or possibly AS to respond.


>
>
> Another possibility is to not do the loop in applescript at all but
> just a single move.


I actually did try this...but as soon as the number of e-mails reaches  
a certain number, Mail becomes "unresponsive".


Michael.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>