Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

xharkila

macrumors newbie
Original poster
Nov 15, 2009
3
0
it's easy to make a window become frontmost by click it or tell it to active,
except Desktop, it won't be the frontmost window of finder when we click on the desktop,
so,
is there anyway to make the desktop "active"?
 
Code:
tell application "Finder" to open folder (path to desktop) as string

Save this in your User Scripts folder (Users:you:Library:Scripts:) and it will be available at all times in your AppleScript menu.

mt
 
Do you need an applescript? Because you could set up expose to use one of the corners to show you the desktop when you scroll to it.

Apple has a video tutorial at apple.

Stephen
 
Code:
tell application "Finder" to open folder (path to desktop) as string

Save this in your User Scripts folder (Users:you:Library:Scripts:) and it will be available at all times in your AppleScript menu.

mt

Thanks a lot. But what I want is

"Auto detect the path of folder was clicked", not
"get the path of desktop",

If used the script above, then it's unable to detect other folders path.
 
Even though AppleScript and Automator are good at detecting changes to folders and then making changes, I think you'll be disappointed at the response at acting on changes you make to your environment, like switching to the Finder.

It'll mean an "on idle" script, which has to be smart enough to know that you've just made the Finder the frontmost app so you want your Desktop folder visible. It'll also have to be smart enough to know that Finder was previously the frontmost app and you either already have the Desktop folder open or you closed it because you want it closed. That's not terribly complex, but the script will do it for every idle message, which will likely mean your machine becomes sluggish. (But maybe you've got a Mac Pro ::)

You've got a few of alternatives ...

Use an Expose hot corner
Keep the desktop window open at all times
Add the Desktop window as a stack in your Dock
Use the script in this thread to activate the Desktop window (You could use something like Butler that would let you activate it with a keystroke.)

mt
 
I think I just discovered the command you wanted... I know you're probably not interested by now, but the "insertion location" command does what you want.

For example, the script

Code:
tell application "Finder"
	set selectedLocation to insertion location as string
	display dialog selectedLocation
end tell

would tell you your active Finder window, even if it was the desktop!

Cheers
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.