On 25/01/2011, at 1:59 AM, Michelle Steiner wrote: On Jan 24, 2011, at 3:17 AM, OzSanta wrote: 1. Is it possible in Applescript to determine if the desktop or a window is the Finders focus?
tell application "Finder" activate try display dialog (get name of the front window) on error display dialog "Desktop is the focus" end try end tell
-- Michelle
G'day Michelle and Christopher.
The suggestion to use the
set sel to selection as alias list works great thanks. BIG improvement.
Unfortunately the other suggestions don't work so well.
1. If icons are selected on the desktop AND in a window at the same time, I want to know what's the focus.
2. The top code only works if no window is open.
3. If a window is open, but unselected, it still shows as the frontmost window.
4. I've already used the code...
try set we_are_on_desktop to ((container of ThisItem as alias) is (path to desktop folder)) on error set we_are_on_desktop to (kind of ThisItem as text = "Volume") --< only Volume icons selected end try
to try and set if we're on the desktop. Trouble is, I had to get an item of the selection first, which took too long if the items were in a folder. Now that it's faster, situation is resolved.
Now I've just got to speed up my icon placement routine. That's another story.
Regards
Santa
|