Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > (AppleShare) Shared Disk Detection and Mounting

(AppleShare) Shared Disk Detection and Mounting
Thread Tools
dutchb0y
Guest
Status:
Reply With Quote
Oct 6, 2000, 11:07 AM
 
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
Guest
Status:
Reply With Quote
Oct 9, 2000, 10:23 AM
 
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
Guest
Status:
Reply With Quote
Oct 13, 2000, 08:56 AM
 
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
Reply With Quote
Oct 27, 2000, 11:29 PM
 
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).]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:02 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2