MACSCRPT Archives

February 2006

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Walter Ian Kaye <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Tue, 7 Feb 2006 23:17:34 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (32 lines)
At 04:59a +0100 02/08/2006, Terry Vogelaar didst inscribe upon an 
electronic papyrus:

>Can I start a script when a specific volume mounts? I want to 
>perform  a backup-like task when the external HD becomes available 
>to the  computer. How do I do that?

You could have a stay-open applet that on idle checks for its 
existence, comparing to the previous state saved in a variable, and 
if it newly exists to run your task. Something like this:

property wasMounted : false --or true, depending on what behavior you want
property diskName : "External HD"

on idle
    set diskList to list disks
    if diskName is in diskList then
       if not wasMounted then
          --run your task
       end if
       set wasMounted to true
    else
       set wasMounted to false
    end if
    return 10
end idle

That's off the top of my head. (Excuse the hairs.)


-boo

ATOM RSS1 RSS2