Re: Do shell script question - timeouts
Re: Do shell script question - timeouts
- Subject: Re: Do shell script question - timeouts
- From: Doug McNutt <email@hidden>
- Date: Sun, 01 Apr 2012 12:34:46 -0600
At 12:34 -0400 4/1/12, Alex Zavatone wrote:
>Hi. I was thinking of writing a quick automatic file sharer by detecting all the local machines on a network and setting up a share on each.
>
>To do this, I was trying this:
>
>set myShellString to "mdns -B _afpovertcp._tcp. local > ~/AFP.txt 2>&1"
>do shell script myShellString
>
>set myShellString to "killall mDNS"
>do shell script myShellString
>
>But the shell command mdns doesn't stop, so the execution doesn't proceed past the first shell script, so I tried this:
>
>on main()
> try
> with timeout of 1 second
> set myShellString to "mdns -B _afpovertcp._tcp. local > ~/AFP.txt 2>&1"
> do shell script myShellString
> end timeout
> end try
>
> set myShellString to "killall mDNS"
> do shell script myShellString
>end main
>
>
>But that seems sort of lame, almost like a cop out. Is there is a preferred method to say to the shell to run for a while, to not wait for a response, or is this the way to do it?
The redirection of both stdout and stderr you're calling for results in no information returning to AppleScript.
I would hope that a child-died signal would tell the script to proceed but I wonder??
What shows up in APF.txt?
--
Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden