Can you select items directly on the desktop, not in a separate Finder window? This doesn’t work:
tell application "Finder"
select items of window of desktop
end tell
Can you select items directly on the desktop, not in a separate Finder window? This doesn’t work:
tell application "Finder"
select items of window of desktop
end tell
I don’t know about selecting all files on the desktop itself, but you can select them all in a window.
tell application "Finder"
select every item of desktop
end tell
Which was exactly the same as what you had. Yay for me being dumb!
It works for me. I made a file called test.txt and a folder called test on the desktop then ran this… they were selected in 10.6.7. It worked even if there were open Finder windows.
set aFolder to (path to desktop as text) & "test:"
set aFile to (path to desktop as text) & "test.txt"
tell application "Finder"
set selection to {aFolder as alias, aFile as alias}
end tell
And this worked if you want to select everything…
tell application "Finder"
set selection to (get items of desktop)
end tell
Your basic problem is “select”. There is no select command, you either get the selection or set the selection.
Standard Suite?
I also tried set selection, but where I actually tripped was the explicit get, or converting the items to select to a type understood by set selection. But thanks, that was a stupid thing to overlook.
Ah, I see that now. Funny though that using “select” instead of “set selection” always opens a Finder window before selecting the items.