Need Help with Script Writing

Discussion in 'macOS' started by davidlv, Jan 16, 2010.

  1. davidlv macrumors 65816

    Joined:
    Apr 5, 2009
    Location:
    Kyoto, Japan
    #1
    We have a new Pioneer Blue-Ray/DVD optical drive that disappears - the Mac Pro 2009 quad loses track of the drive after a short period of time. One of the readers of the xlr8yourmac page, Lian, was kind enough to offer the script below that polls the drive every 28 seconds, which does work to keep the machine aware of the drive. However, this script, saved as a run only application, will not quit gracefully, requiring a forced quit.:eek:
    repeat
    do shell script "drutil info"
    delay 28
    end repeat
    Could someone versed in applescript tell me how to modify this script so that it will quit on demand or when the system is shut down?
    Thanks in advance for the help.
     
  2. andmr macrumors member

    Joined:
    Aug 25, 2008
    Location:
    NE Florida
    #2
    You might try this instead:

    on idle
    do shell script "drutil info"
    return 28
    end idle

    Save the script as an application and be sure to check "Stay Open" under Options.

    Good luck.
     
  3. davidlv thread starter macrumors 65816

    Joined:
    Apr 5, 2009
    Location:
    Kyoto, Japan
    #3
    Thanks so much! That seems to work right, at least it runs and quits on demand, and the Pioneer BRD-205 drive remains visible to the Mac Pro. I have been advised that "return 120" will also work.
     

Share This Page