Loading...

applescript-users@lists.apple.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Do shell script question - timeouts Alex Zavatone Sun Apr 01 10:00:36 2012

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?

Thanks,
- Alex
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      ([EMAIL PROTECTED])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/applescript-users/alexiscircle%40gmail.com
Archives: http://lists.apple.com/archives/applescript-users

This email sent to [EMAIL PROTECTED]