Re: Strange iDisk name (e.g., name-1)
Re: Strange iDisk name (e.g., name-1)
- Subject: Re: Strange iDisk name (e.g., name-1)
- From: Graff <email@hidden>
- Date: Wed, 17 Dec 2003 13:15:43 -0500
If the iDisk is already mounted perhaps you could get the URL of every
mounted volume and compare it to the URL you are trying to mount? Then
the disk that matches is the disk you would want to use.
I think the following code will work, but I don't have an iDisk to test
it on. It seems to work fine with local volumes:
-------------
global theiDisk
global iDiskUrl
set iDiskUrl to "afp://"
set gotDisk to findDisk()
if gotDisk is false then
mount volume iDiskUrl
set gotDisk to findDisk()
end if
if gotDisk is false then
display dialog "Unable to mount or find the iDisk"
else
-- do something with the iDisk here
-- the variable "theiDisk" contains an alias to it
end if
on findDisk()
set iDiskFound to false
set volumeList to list disks
tell application "Finder"
repeat with theVolume in volumeList
if (theVolume as text) is not "Network" then
if (local volume of disk theVolume) is false then
if (the URL of theVolume) is equal to the iDiskUrl then
set theiDisk to theVolume
set iDiskFound to true
end if
end if
end if
end repeat
end tell
return iDiskFound
end findDisk
-------------
- Ken
On Dec 17, 2003, at 4:32 AM, Jeffrey Mattox wrote:
Ken:
I can't ask the user to select a name because most users wouldn't have
a clue which name to choose. If there's more than one choice (e.g.,
"name" and "name-1"), the most obvious choice, "name", is the worst
one because the OS didn't use it for some reason.
Your second idea sounds like it might work, but if mount volume
actually mounts the iDisk, it returns the correct name, e.g.,
"name-1". The problem is if the iDisk is *already* mounted. In tat
case, "mount volume" fails without returning a name and there won't be
any change in the /Volumes directory.
Jeff
At 7:57 PM -0500 12/16/03, Graff wrote:
Well, I would handle it as a user choice. I'd ask the user where
they wanted to save the file through a dialog:
set theFolder to choose folder
That way it could be handled intelligently by a person rather than
just casting around with a script.
If you needed to do it without user interaction then I'd say you
would have to first get a listing of the /Volumes directory, then
mount, then get a second listing. Any new mount points in there
should be the volumes you just mounted. Save references to those
mount points and refer to them whenever you need to save to them.
- Ken
On Dec 16, 2003, at 5:34 PM, Jeffrey Mattox wrote:
I agree. The problem now is how does an AS program determine which
directory in /Volumes should be used given a disk name?
At 12:04 PM -0500 12/16/03, Graff wrote:
Right, in the Volumes directory every name has to be unique. The
way the OS handles this is to name any subsequent mounts with a
suffix of "-1", "-2", etc. so they won't overwrite each other. The
name of the volume as it appears to the Finder will probably be
seen without the extra suffix because that is read from the volume
information rather than from the name of the mount point. So you
can have a couple of mounted disks with the same name in the
Finder, but they will all have a unique name in /Volumes
This can result in one application getting the name of the volume
with the suffix while another gets it without the suffix, depending
on how they get the names.
- Ken
On Dec 16, 2003, at 11:35 AM, VRic wrote:
15/12/03 Jeffrey Mattox :
Sometimes an iDisk mounts as "name-1" instead of "name". What's
up
with that?
I didn't pay much attention to it, but this happened to me
recently when
mounting 2 similar disk images.
There seems to be discrepancies in the way OS X names the resulting
volumes and which name applications see (maybe new in Panther, and
maybe
related to the new 2 flavors of mount).
2 disks with the same name should appear as such like in OS 9, but
probably the "Volumes" folder can't have 2 items with the same
name and
applications don't seem to agree on where to get the volume name.
_______________________________________________
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.