Applescript help with .sleep script

Discussion in 'Mac Programming' started by danb77, Oct 3, 2007.

  1. danb77 macrumors 6502

    Sep 4, 2007

    I am trying to write a .sleep script to employ with the handy SleepWatcher utility to unmount my USB disks and network disks when I send my MacBook to sleep.

    My current script is

    osascript -l AppleScript -e 'tell Application "Finder" to eject every disk whose ejectable is true or not local volume is true'

    The problem with this is that it does not verify that the unmount has been successful, so sometimes the computer shuts down with the drives still mounted.

    Does anyone have an idea how I can change the script to:

    Wait until the mount has been successful before finishing (and allowing SleepWatcher to shut the system down)

    If this does not occur within n seconds display an error message.

    Thanks in advice,

    Dan (the applescript newbie!)
  2. danb77 thread starter macrumors 6502

    Sep 4, 2007
    OK, so maybe this wasn't the best place to post this question. Can anyone recommend a good Applescript forum?
  3. xUKHCx Administrator emeritus


    Jan 15, 2006
    The Kop
    Here is a good one
  4. MongoTheGeek macrumors 68040


    Sep 13, 2003
    Its not so much where you are as when you are.
    try this.

    umount -f /volumes/*

    It will fail on the system disk unless you are running as root but will unmount everything else.

    As for a place to ask scripting questions there is the MACSCPT listserv run out of Dartmouth. Volume has dropped off tremendously but there are a lot of people there with a lot of knowledge in different scripting languages.
  5. danb77 thread starter macrumors 6502

    Sep 4, 2007
  6. kainjow Moderator emeritus


    Jun 15, 2000
    This site seems to be fairly active.

Share This Page