Apple Script

Posted on 2009-02-11
Last Modified: 2013-11-17
Dear all,

I am looking for a script that would run in the background pinging this address and when the ping gets a response i want it to mount two afp drives.

Would this be possible?

The script would run in the background?


Lyon JT
Question by:LyonJay
    LVL 3

    Author Comment

    Thank you!

    Much apprieated!


    LVL 24

    Accepted Solution

    Hi Lyon,

    What you want to do is easily achievable in shell script.  Using AppleScript to run in background, etc is a bit tedious.  Anyhow, I have written a short AppleScript that "almost" do what you need and you may tweak it a bit more:

          tell application "Finder"
                      set ping_result to (do shell script "ping -c 1 | tail -1")
                      if "100% packet loss" is not in ping_result then
                            mount volume "afp://" as user name "username" with password "password"
                      end if
                end try
          end tell
    end repeat

    A simpler suggestion is using shell script:

    ping -o >/dev/null
    osascript -e 'try' -e 'mount volume "afp://username:password@"' -e 'end try'

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Macbookpro 8 70
    Apple iPhone Showing email address 6 43
    Current IT security breaches/attacks in banking 2 75
    iTunes problem 5 52
    Does your iMac really need a hardware upgrade? Will upgrading RAM speed-up your computer? If yes, then how can you proceed? Upgrading RAM in your iMac is not as simple as it may seem. This article will help you in getting and installing right RA…
    Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
    Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …
    Users will learn how to set proper sequence settings, scale images, paste attributes, add transitions, fades, and music. Open up Final Cut Pro 7 and Create a new Project: Set the Sequence Settings. a) Click File > Easy Setup > Format > Apple ProRe…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now