Re: Delaying a script
Re: Delaying a script
- Subject: Re: Delaying a script
- From: "Klaas.Lists" <email@hidden>
- Date: Wed, 19 Jan 2005 17:33:15 +0100
Op 19-jan-05 schreef Christopher Nebel:
>On Jan 18, 2005, at 10:46 AM, Klaas.Lists wrote:
>> My script is using a DO SHELL SCRIPT action,
>> which returns a result (via the Clipboard).
>>
>> It would not work, DISPLAY DIALOG result would
>> not show the correct value, until I realised
>> that my script would continue running, not
>> waiting for the DO SHELL SCRIPT to finish.
>>
>> What I would like to know: What is the accepted
>> way to wait in AppleScript, without a busy loop?
>Well, you could use the "delay" command, but that just takes a number
>of seconds to wait -- there's no command to wait for a condition. You
>can get away without an actual loop in some cases by using an "on idle"
>handler, which gets called periodically if your script is saved as an
>application.
Thank you all for thinking with me.
I discovered the delay command, but have not tested it. But even at
0.1 sec there are still only about 36000 transacties I can process
per hour.
>However, the fact that you're having this problem in the first place is
>sort of weird -- usually people have the reverse problem; they want "do
>shell script" to *not* stop execution of their script. A few things to
>consider:
>1. Did you deliberately background the process using "&"? If so, stop
>doing that.
>2. If the command is somehow detaching itself, does it have an option
>to not do that?
>3. Why use the clipboard? If the shell command has output, it will be
>returned as the result of the "do shell script" command. For example:
> set x to do shell script "echo foo"
> x --> "foo"
>You may find <http://developer.apple.com/technotes/tn2002/tn2065.html>
>helpful.
I read the Techincal Note.
But, I never realised that do shell script is an asynchronous process.
I will test the result format, but
what I am doing is invoking a REXX (Regina) exec through the
do shell script. Why? Well there is a process that is not so
easily programmed in AppleScript, and I have the code in
REXX (which to me, as a PL/I programmer, feels like heaven
compared to AS).
So I figured a way to communicate between the two. Of course
I will pleased with a better way to do this.
So once again thank you, and I will dived deeper into it.
---
Klaas.
_______________________________________________
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