Re: Ignore a script object or applet or what...?
Re: Ignore a script object or applet or what...?
- Subject: Re: Ignore a script object or applet or what...?
- From: Emmett Gray <email@hidden>
- Date: Thu, 24 Feb 2005 10:33:56 -0500
Hi,
I just found this in technote 2065 at developer.apple.com; I can
write to a file AND return control. Thanks for the tip.
--Emmett
A: Use "do shell script "command > file_path 2>&1 &"". do shell
script will return immediately with no result and your AppleScript
script will be running in parallel with your shell script. The shell
script's output will go into file_path; if you don't care about the
output, use "/dev/null". There is no direct support for getting or
manipulating the background process from AppleScript, but see the
next question.
On 2/23/05 10:59 PM, "Emmett Gray" <email@hidden> wrote:
Hi,
I'm trying to track the progress of a psync operation I've scripted,
by using fstat to see if the psync output is still open. The reason I
want to do this is because I want to do something else in the script
while psync is running (it could run for quite a while). I would plan
to use an idle handler to run fstat periodically. I'm using the
following code:
do shell script ("/usr/local/bin/psync " & theSource & " " & theDest
& " > ~/Library/Logs/" & logName)
do shell script "fstat ~/Library/Logs/" & logName
What is happening is that fstat doesn't get a chance to run until the
psync operation is finished, so it always reports the logfile as
closed. Can I create a script object or other object in which to put
the psync action which I could then ignore and proceed to the next
script step while it runs?
Andrew Oliver <email@hidden> responded:
Standard 'do shell script' stuff. To background a shell script task you need
to append ' > /dev/null 2>&1 &' to the end of the command. This suppresses
output and returns control to your AppleScript while the process runs in the
background, so:
_______________________________________________
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