 |
 |
(AppleShare) Shared Disk Detection and Mounting
|
 |
|
 |
|
dutchb0y
|
|
Hi,
I need help with a Script that will check every 24hrs if a certain ASIP shared disk is mounted, and if it isn't, to access it's Favourite (that's the easy bit)
I can't figure out the timing part, nor fully how to use the "exist" term in reference to a shared disk.
Any help would be much appreciated!
|
|
|
| |
|
|
|
 |
|
 |
|
MarkPriddy
|
|
Dutchb0y,
Some things to point you in the right direction:
1) idle handler
Place an "on idle" handler in your script. Check the "Stay Open" option in when you save the script as an applet. This will cause "idle" messages to periodically be sent to your applet, which can respond as necessary. If you return an integer at the end of the handler, the OS will wait that many seconds before issuing another "idle" message to your script. 24 hours = 60 * 60 * 24 = 86400 seconds.
on idle
--do something interesting
return 86400
end idle
2) iDo Script Scheduler
If you have Mac OS 9, you have the demo version of the iDo script scheduler. It's in the CD Extras:AppleScript Extras on your 9 CD. I've attached a copy, just in case you can't find your CD. This allows you to schedule script execution. Keep in mind that you may have to slightly modify your scripts, as they run in the same context as the scheduler, instead of in their own context.
3) Check the disks in the Finder
All you have to do to check if a disk is mounted is get a list of disks from the Finder.
tell application "Finder"
set mountedDisks to name of disks
end tell
builds a list of disks. Check for your target disk name to see if it's mounted. Won't work reliably if you have some removable (like a Zip) that has the same name as your server volume, but hopefully that's not an issue.
Hope this helps you.
Mark <><
|
|
|
| |
|
|
|
 |
|
 |
|
dutchb0y
|
|
Thanks for those tips, I'll try 'em out and see what I can get going!
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 1999
Location: Georgetown, Demerara, Guyana
Status:
Offline
|
|
Hi all,
Just wanted to add a few notes on Mark's item #3: - It is also possible to test directly for the presence of a particular mounted volume, via the Finder's exists clause (e.g., 'tell application "Finder" / if exists disk "disk-name" ... / ... / end tell').
- In recent Mac OS versions, it is possible to reliably determine whether a mounted volume is local or remote, via the Finder's local volume property for disks (e.g., 'tell application "Finder" / if local volume of disk "disk-name" ... / ... / end tell').
Regards,
--Paul
[This message has been edited by Paul Crawford (edited 10-28-2000).]
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|