Re: Disk or Volume path help needed
Re: Disk or Volume path help needed
- Subject: Re: Disk or Volume path help needed
- From: "Robert Kiolbassa" <email@hidden>
- Date: Thu, 14 Jul 2005 11:02:11 -0500
- Thread-topic: Re: Disk or Volume path help needed
Hello J. Stewart, Peter Waibel
Thank you both for your assistance. I had not thought of asking for the last word of the URL, and that would free me up from using TIDs. I had a script running which behaves as I wish, except...
... some older servers I access using AFP protocol use two word server names. Using AFP, if a server is already mounted, my mount routine just goes ahead and opens the folder I specify later on. Unfortunately the SMB server does not behave the same. I do need to test if the SMB server is mounted before the mount command is made, because if the SMB server is already mounted and the script is run, the script brings up the sign in dialog anyways and errors after that is entered.
Right now the one word servers are SMB, and the two-word servers are AFP, so the "word" scripts "work". But to keep things orderly and to prepare for future servers that might complicate this, I am using TIDs and looking for item -2 of the list and that method works so far. Below is the handler I ended up with.
on isMounted(networkLoc)
-- get volume name from URL, because of this don't need suggested: (last word of shareName)
-- which would not work with two word volume names
set oldTIDS to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set urlAsList to every text item of networkLoc as list
set AppleScript's text item delimiters to oldTIDS
set shareName to item -2 of urlAsList
--set diskList to list disks -- works fine for one word volume names
--set diskList to (do shell script "ls /Volumes") -- lists mounted disks exc "network" -- works but advice not to use
tell application "Finder"
set diskList to (name of every disk whose local volume is false)
end tell
--suggested: if diskList contains (last word of shareName) then -- but used below for 2 word
if diskList contains (shareName) then
return "true"
else
return "false"
end if
end isMounted
Thanks again for your assistance,
Bob
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden