• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Strange iDisk name (e.g., name-1)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange iDisk name (e.g., name-1)


  • Subject: Re: Strange iDisk name (e.g., name-1)
  • From: Graff <email@hidden>
  • Date: Thu, 18 Dec 2003 04:03:01 -0500

Yeah, I just found out some of these things. Gnarlodious was kind enough to loan me the use of his iDisk so I could test the script.

As you saw, for some reason if I mount this URL:
"afp://idisk.mac.com/gnarlodious"

When I get the URL of that mounted volume it looks like:
"file://localhost/Volumes/gnarlodious"

There doesn't seem to be any way to determine the original URL of a mounted network volume via AppleScript, unless someone knows of another way to find out this data

But hey, if this fumbling about of min has brought you to a good solution for your problem then I can pat myself on my back and consider my work done! :-)

Good luck with it.

- Ken


On Dec 18, 2003, at 3:22 AM, Jeffrey Mattox wrote:

Graff:

Your idea shows great promise.

1. There's a typo in the script. The innermost test should be (added "disk"):

if (the URL of disk theVolume) is equal to the iDiskUrl then

2. The code works, but not as you expected. The URL returned might not match the URL used when mounting the iDisk. If I force the Finder to mount my "name" iDisk at "name-1" (by manually creating a directory "name"), then the URL returned for my iDisk is:

file://localhost/Volumes/name-1/

However, if I assume that the iDisk is the only disk satisfying the first two conditions (is not network and is not local), then the URL contains the mount point of the iDisk, which is what I need to know. Great! To be even more sure, I can check for an exact match or a name with a dash.

So, for the record, here's a modified version of your script that works:

set idiskName to "name" -- your actual iDisk name goes here
set theMountPoint to ""
try
set theVolume to "http://idisk.mac.com/"; & idiskName -- returns "name:" or "name-1:"
set {delims, text item delimiters} to {text item delimiters, ""}
set theMountPoint to (characters 1 thru -2 of ((mount volume theVolume) as string) as string) -- remove trailing ":"
set text item delimiters to delims -- restore
on error theError number errorNumber
if (errorNumber is -55) then -- already mounted (it might be a "name-1")
set theNotLocatCount to 0
set theDiskList to list disks
set {delims, text item delimiters} to {text item delimiters, "/"}
tell application "Finder"
repeat with theVolume in theDiskList
if (theVolume as text) is not "Network" then
if (local volume of disk theVolume) is false then
set theURL to (the URL of disk theVolume)
-- expecting "file://localhost/Volumes/name/"
-- but could be "file://localhost/Volumes/name-1/"
set theTemp to text item -2 of theURL
if (theTemp is idiskName or theTemp starts with (idiskName & "-")) then
set theMountPoint to theTemp
set theNotLocatCount to theNotLocatCount + 1
end if
end if
end if
end repeat
end tell
set text item delimiters to delims -- restore
if (theNotLocatCount > 1) then -- warning
display dialog "WARNING: multiple non-network, non-local iDisks mounted"
end if
end if
end try
if (theMountPoint is "") then
display dialog "Unable to mount or find the iDisk"
else
display dialog "The iDisk '" & idiskName & "' is mounted at /Volumes/" & theMountPoint
end if


Thank you for your help.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Strange iDisk name (e.g., name-1) (From: Graff <email@hidden>)
 >Re: Strange iDisk name (e.g., name-1) (From: Jeffrey Mattox <email@hidden>)
 >Re: Strange iDisk name (e.g., name-1) (From: Graff <email@hidden>)
 >Re: Strange iDisk name (e.g., name-1) (From: Jeffrey Mattox <email@hidden>)
 >Re: Strange iDisk name (e.g., name-1) (From: Graff <email@hidden>)
 >Re: Strange iDisk name (e.g., name-1) (From: Jeffrey Mattox <email@hidden>)

  • Prev by Date: Re: Filter reference form question
  • Next by Date: Re: How to prevent Classic from starting?
  • Previous by thread: Re: Strange iDisk name (e.g., name-1)
  • Next by thread: (name-1), Is this a bug?
  • Index(es):
    • Date
    • Thread