Re: do shell script speed (URL Access Redux)
Re: do shell script speed (URL Access Redux)
- Subject: Re: do shell script speed (URL Access Redux)
- From: Andrew Oliver <email@hidden>
- Date: Wed, 24 May 2006 16:57:30 -0700
On May 24, 2006, at 4:46 PM, Emmanuel wrote:
Great you explained that, thanks. We updated the page above.
For a happy ending, I recall that do shell script's AppleScripty
competitor, that is, having Terminal run in the background and
scripting it, may make an efficient solution.
I report a quick test with "ls":
do shell script "ls"
-- 24 ms
tell application "Terminal" to do script "ls ../../ > a" in window 1
read alias "emmanuel's hd1T:Users:emmanuel:a" as «class utf8»
-- < 3 ms
As someone else recalled, AppleScript is primarily an
interapplication language. The good news is: it is fast like a
greased lightning.
Don't be misled with those timings.
'tell application 'Terminal" to do script..' times ONLY the amount of
time it takes AppleScript to pass the event to Terminal.app. There is
no waiting for the command to execute, no callback and there's no
indication as to the success (or otherwise) of the command.
For example, OMM the following script takes 0.34 seconds to execute
in Script Debugger:
tell application "Terminal" to do script "sleep 10"
Clearly, it should take 10 seconds (plus a little bit).
This can be critical if you're stringing together a number of
commands since you have no idea whether the previous command has
finished, and therefore whether Terminal.app is going to queue the
processes accordingly.
Of course, you can execute subsequent commands in separate windows,
but that doesn't help if you need the commands to be sequential.
Andrew
:) _______________________________________________
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