Re: Desktop question
Re: Desktop question
- Subject: Re: Desktop question
- From: email@hidden
- Date: Thu, 25 Jan 2001 22:47:02 -0500
On Thu, 25 Jan 2001 06:24:55 -0500, Bill Cheeseman <email@hidden> noted,
>
But, interestingly, this also works:
>
>
tell application "Finder"
>
set name of file "Temp" of desktop of disk "MyDisk" to "Perm"
>
end tell
I see this as a missing entry of the Finder's dictionary, that a disk object has
a desktop object as a property. But it isn't really useful, because desktop of
disk "(Anything)" is always just 'desktop of application "Finder"' 'set name of
file "Temp" of desktop of disk "MyDisk" to "Perm" works no matter what disk name
you use, whether the file is on that disk or some other disk. (Note that this
is a property reference, "desktop of disk "MyDisk", and not an element
reference, 'desktop 1 of disk "MyDisk"'.) Its possible in AppleScript for a
property and an item to have the same name. For example, a container has file
elements, but a process has a file property.
>
>
If you ask for the name of the desktop of disk "MyDisk", you get "Desktop",
>
not "Desktop Folder":
>
>
tell application "Finder"
>
get name of desktop of disk "MyDisk" --> "Desktop"
>
end tell
The desktop is a "desktop-object", which is a container but not a folder. Its
not unreasonable that the Finder abstracts away the implementation detail that
the desktop is really the union of the various disk's desktop folder.
>
Yet this does not work:
>
tell application "Finder"
>
set name of file "Temp" of folder "Desktop" of disk "MyDisk" to "Perm"
>
end tell
Since its not a folder, that's not surprising. If you say "container" or
"desktop-object", and drop the "disk" part, it works. (Since the desktop-object
is a property of a disk and not an element of a disk, you can't use a name
reference to get it. So 'container "Desktop" of disk "MyDisk"' doesn't work, as
a disk has no such element. But 'container "Desktop" of application "Finder"'
does work, since the Finder itself has the desktop as one of its containers.
Perhaps I'm retconning a bit, explaining how the Finder's desktop object is a
perfectly consistent paradigm when it's really just a kludge. I'll admit, it's
not all that clear, and its easy to expect that you can deal with the desktop as
a folder, because its a folder underneath. But to the Finder, its a container.
Having desktop as a property of a disk is probably a mis-implementation, and
adds to the confusion. If the desktop property of a disk were to return the
disk's desktop folder, that would be useful. But I'd rather that property were
called "desktop folder" and not just "desktop".
--
Scott Norton Phone: +1-703-299-1656
DTI Associates, Inc. Fax: +1-703-706-0476
2920 South Glebe Road Internet: email@hidden
Arlington, VA 22206-2768 or email@hidden