Cluttered Desktop: Making AppleScript Do Something Useful

by Jacek Artymiak

My Desktop is always covered by at least a dozen windows. If I had to minimize all windows just to open a file I keep on the Desktop, I'd quickly turn into a very unpleasant creature. Fortunately, there is a solution!



If you don't want to keep on clicking those green buttons, do this:




  • Double click on the system disk (Macintosh HD).

  • Click on the Applications button on the window toolbar.

  • Double-click on the AppleScript folder.

  • Double-click on the Script Editor.

  • Copy this code and paste it into bottom text field.



tell application "Finder"
activate
try
open ("Macintosh HD:Users:yourusername:Desktop")
end try
end tell



  • Replace yourusername with your own user name.

  • Save Script As Show My Desktop.

  • Quit Script Editor.

  • Drag and drop the Show My Desktop script icon onto the Dock strip.



Now you can open as many full-screen windows as you like, and if you want to see what's below them, just click the Show My Desktop icon on the Dock.



UPDATE: 8:39AM (GMT+1) 4/10/2003 You must save this script as Application.



21 Comments

hondo77
2003-04-09 09:49:54
Why Applescript?
Why use Applescript for this? You could do this two other (easier) ways):


Put an alias to the desktop in the dock.


Put your desktop in the toolbar of your finder.

anonymous2
2003-04-09 12:19:09
Command-option click will do the job
Command-option clicking on the desktop or the Finder icon in the dock will do the same for you.
Thanks to Ken Bereskin's weblog for this trick...
http://radio.weblogs.com/0100676/
anonymous2
2003-04-09 12:52:22
Command-option click will do the job
No doubt. I've got that programmed into the wheel button on my Logitech cordless mouse. It's now a one-click process to "hide others" when clicking on ANY other application icon in the dock. That includes the Finder or any other open applications!
anonymous2
2003-04-09 13:28:47
A simpler Applescript...
The following simpler script works for Jaguar, and maybe earlier version of OS X:


tell application "Finder"
activate
try
open desktop
end try
end tell



anonymous2
2003-04-09 13:57:53
And furthermore . . .
If you've named your hard drive to something other than
"Macintosh HD" the script won't work. You can actually start
with "Users" anyway and leave the first part out.
artymiak
2003-04-09 13:58:47
Why Applescript?
These methods don't seem to work on my computer running Mac OS X 10.1.5. The AppleScript script works just fine.
artymiak
2003-04-09 14:00:56
Command-option click will do the job
Nice tip! Thanks for this one.
anonymous2
2003-04-09 14:39:25
Command-option click will do the job
But then you cant do this with your wheel button:


http://osxfaq.com/Tips/murphy/


(last I checked, you needed a microsoft mouse to do this)


OSXFAQ Reader Tip By Chris Murphy


I set my scroll wheel to automatically trigger the Universal Access zoom in and out feature.


I use a Microsoft Intellimouse. In the Microsoft Mouse panel I set the "Press and Roll Forward" to Keystroke Command-Option + and the "Press and Roll Backward" to keystroke Command-Option -


Then I turned on zooming in the Universal Access Panel.


When I press and roll forward on the scroll wheel, it zooms in on the part of the screen I want to study. It works so well, I use it every few minutes to study images on the web or get a closer look at small text.


For those that dont have a Microsoft Mouse, this will probably work in USB overdrive.


Also, I made one exception for Photoshop so that instead of using the Universal Access Zoom, it uses the Photoshop zoom. The shortcuts are Command + and Command - in that case.


Enjoy :-)

anonymous2
2003-04-09 15:15:49
And furthermore . . .
This version should work on any Mac.


set ptd to path to desktop


tell application "Finder"
activate
try
open
end try
end tell

anonymous2
2003-04-09 16:59:44
Why Applescript?
Actually, you don't need to put an alias into the dock & it would work better if you don't as the alias could get trashed/lost. Just go to your home folder and drag the Desktop folder into the dock (in the folder/window section -- not where apps go).
anonymous2
2003-04-09 18:23:39
put it in the Dock...
anonymous2
2003-04-09 19:36:14
Command-option click will do the job
Don't you mean OPTION-CLICK onto the desktop? This is a left over from OS 9.



the veggiedude

anonymous2
2003-04-09 21:06:45
easiest still
drag your desktop folder to the dock.
now, if you need to see the desktop, just click on the icon.


much faster than an applescript.

artymiak
2003-04-09 23:30:23
Why Applescript?
You're right. Thanks!
anonymous2
2003-04-10 02:30:14
Extension on this
I created a Directory and called it hiddenDesk. Give it the Icon from Desktop in your home-dir. Drag&Drop hiddenDesk on your Toolbar of a Finder Window. Then I created a crontab that moves every minute all the files from the Desktop into my hiddenDesk. This way I always can enjoy my Desktop Picture without any files on it. And My Desktop is still as accessible via a Finder Window. An other advantage is that icons on your desktop are quite often a mess. Via a Finder Window you could choose to view it as List.
anonymous2
2003-04-10 15:36:07
use Show Desktop freeware- EASY /no scripts required
Just one good click away- use Show Desktop



http://www.everydaysoftware.net

artymiak
2003-04-11 01:30:10
Extension on this
Cool!
anonymous2
2003-04-22 14:34:20
Why Applescript?
Your method doesn't hide everything else, which was the whole point of the original tip.
anonymous2
2004-01-02 22:53:48
another launcher
An even better solution is to download another launcher. You can put your desktop in the top menu bar and view its contents anytime you want to.
RonaldMHofmann
2004-06-17 19:40:45
Opn desktop
I prefer this one since it works immediately without modifications. Username and diskname are implied:


tell application "Finder"
activate
open (desktop as text)
end tell

mrcqm
2006-01-07 20:24:50
VERY simple in OS 10.4
press F11. all windows slide off the nearest edge. I use this, for instance, when I want to move an image into a document. Assume I have my doc and about 15 other windows open. I make the target doc the active window and then press F11. I click on the image I need from the desktop and press F11 again. I then drop it into the doc. Couldn't be easier.