Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

crul

macrumors newbie
Original poster
Jul 29, 2012
3
0
(using xcode/applescript)

I have made an applescript app which (after the user presses a button) mount several remote volumes. In the interface, I want the user to be able to see if the server is actually available. I've done this with an "on/off-light" which is controlled with a timer:
Code:
set myTimer to NSTimer's scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(timerCounter, me, "serverCheck:", missing value, true)

Code:
on serverCheck_()
    set serverUp to true
    try
        do shell script "ping -c 1 -t 1,5 192.168.16.2"
    on error
        set serverUp to false
    end try
         
    if serverUp
        ...
    else
        ...
    end if
end serverCheck2_

The script is working fine, but my problem is when the server isn't available. This couses the ping to wait for a time -t (1,5 in this case) until it timeouts. During this waiting time the interface is irresponsive (user can't select volumes or even close the app.).

Is there any way to solve a problem like this? Help is much appreciated.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.