Re: Selecting every item of one disk's desktop
Re: Selecting every item of one disk's desktop
- Subject: Re: Selecting every item of one disk's desktop
- From: Richard 23 <email@hidden>
- Date: Mon, 26 Feb 2001 22:30:46 -0800
>
I'm trying to select every item of one disk's desktop. I have a specific
>
reason why I'm trying to delete items from that hidden folder on a
>
particular disk.
Here you go. Just by coincidence I was working on a script that
does this last weekend. I burned a couple of discs, deleted a bunch
of files, then wanted to get a good idea of which volume my desktop
items came from (esp the big folders). So I wrote a script that
colorizes (sets the label index) of desktop items based on the index
of the volume they came from.... Visually very clear.
Probably will upload the script to my site tonight or tomorrow.
Desktop Colorizer, should be on page 2 when I upload it.
There's a couple of other scripts there for working with multiple
volumes, so you may want to take a look.
<
http://homepage.mac.com/richard23/>
Here's an excerpt that should help you out:
-- ---------------------------------------------------------
-- Preprocessed by Convert Script 1.0d4
-- ---------------------------------------------------------
-- author: Richard 23, date: Monday, February 26, 2001
-- ---------------------------------------------------------
set volumeList to list disks
set theLen to result's length
tell application "Finder"
set theRef to a reference to (items of desktop where name /= "Trash")
set idList to id of result's disk
end tell
set {theList, aliasList} to {AsAliasList(theRef), {}}
repeat with theIdx from 1 to theLen
set end of aliasList to {}
end repeat
tell idList to repeat with theIdx from 1 to length
set end of aliasList's item -(item theIdx) to theList's item theIdx
end repeat
-- this selects all desktop items of the startup volume (disk 1)
tell application "Finder" to select aliasList's item 1
-- aliasList contains a list of lists, one for each volume
-- each list contains a list of aliases: a single volumes desktop items
return aliasList
-- ------------------------------------------
-- workaround for single-item alias list bug
-- ------------------------------------------
on AsAliasList(theRef)
try
theRef as <<class alst>>
on error
theRef as alias as list
end try
return result
end AsAliasList
-- ---------------------------------------------------------
Let me know if you have any questions.
R23