Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Set 'All Windows' and other view options via AppleScript Desktop
After reinstalling my system recently, I had a look at the mess my windows had turned into, and started looking into AppleScript as a means to set my windows to my preferred view settings. As it turned out, there was no easy way to set the "All Windows" option -- the only scriptable commands in Finder applied to "This Window Only" settings. Then I learned about GUI Scripting, and after a couple days of trial and error I got the thing to work reliably -- here's the code.

What the script does:

You can either drop items into it or open it, in which case you will be prompted to open a folder. At the start, Finder is activated, all Finder windows are closed, and the "Show View Options" window is opened. The script also stores the username of the current user, which it needs for checking read rights for folders.

The script processes both disks and folders recursively. Each disk or folder is set to icon view, opened, moved and resized, and the sidebar width is set. Then the "This Window Only" icon view options are set to my defaults. Then "All Windows" is set for icon view options. Next, the "This Window Only" list view options are set to my defaults, and finally, "All Windows" is set for list view options. Last of all, the zoom button is clicked, which resizes the window. After all disks and folders have been processed, a dialog box is shown stating the number of folders/disks processed.

Note that you should not do anything else on the computer while the script is running. The script depends on the Finder windows remaining in a certain order, and Finder must stay active. If you do want to stop the script, close any window, and the script will harmlessly crash, displaying an error message. Note that the script takes a long time to run: in my tests, processing 300 folders took about an hour.
read more (612 words)   Post a comment  •  Comments (1)  
  • Currently 2.50 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[11,182 views]  View Printable Version
Set Finder color labels via Butler and AppleScript Desktop
I'm one of those "keep my hand on the keyboard at all times" sort of guys. So I was annoyed recently when I discovered that there was no keyboard shortcut to set an item's color label in the Finder. While I don't always use the Finder's color labels, I often find them invaluable when working on projects with complex file and folder structures, indicating which files are "done" and which files are "pending." Using Butler's outstanding ability to execute any AppleScript code via a key combination, I set up the following script:
tell application "Finder"
  set thisItem to selection as alias
  if label index of thisItem = 0 then
    set the label index of thisItem to 2 -- 2 = red
  else
    set label index of thisItem to 0 -- 0 = no label
  end if
end tell
I then set it to run with the arbitrary key-combination of Option-Command-Control-L. This code will toggle on and off the Red label only. However, using Butler and modifying the AppleScript, one could set a combo to toggle all the different labels on and off -- perhaps using one to six on your keyboard, with appropriate modifier keys.
  Post a comment  •  Comments (9)  
  • Currently 2.83 / 5
  You rated: 3 / 5 (6 votes cast)
 
[19,528 views]  View Printable Version
Disable the Finder's 'snap to grid' icon animation Desktop
If you don't like watching the Finder's "snap to grid" animation, open Terminal and enter this command:
Defaults write com.apple.Finder AnimateSnapToGrid -bool FALSE
You'll then need to restart the Finder (using Activity Monitor, Terminal, AppleScript, logging out, or whatever other method you prefer) to have the change take effect.

[robg adds: This one works as described, and wasn't covered in this previous tip, which listed a number of other animation-disabling settings.]
  Post a comment  •  Comments (1)  
  • Currently 2.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[10,287 views]  View Printable Version
A shortcut to help with file renaming Desktop
When renaming files in Finder, click on the file, press Enter to bring up the rename input box, then while holding down Option, press the right arrow key. This will bring you to the end of the filename, but before the dot extension. Similarly, Option and left arrow brings you to the beginning. Just a little hint that may save some time while renaming.
  Post a comment  •  Comments (13)  
  • Currently 2.67 / 5
  You rated: 5 / 5 (6 votes cast)
 
[29,664 views]  View Printable Version
Export folder path from Finder via the proxy icon Desktop
In response to a recent Mac Gem, there is an even easier way to export the path to the current folder from the Finder: You can click on the icon next to the finder window name and then drag and drop it to your favourite text editor, or even Terminal. This also works with files in the Finder window.

[robg adds: There are some other methods presented in the comments to the Mac Gems piece, some of which we've covered here before.]
  Post a comment  •  Comments (5)  
  • Currently 2.25 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[12,216 views]  View Printable Version
Quickly minimize and restore a Finder window Desktop
Let's say you're working on a Finder window which covers another window (not necessarily another Finder window) on which there is an information you need. What do you usually do? You use Exposť, Command-Tab, etc.

But there's another solution: if you're able to read very fast, you can triple-click (as quickly as possible) the title bar of the Finder window. It will minimize and then immediately unminimize. I don't know whether this is a bug or not, but it only works with Finder.

[robg adds: Somewhat obviously, this also only works if you've enabled Minimize when double clicking a window title bar in the Appearance System Preferences panel.]
  Post a comment  •  Comments (14)  
  • Currently 1.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (3 votes cast)
 
[11,133 views]  View Printable Version
Cheap and RAM-frugal desktop hiding Desktop
I don't like the distraction that comes with having a lot of stuff on the desktop There are lots of apps out there to hide the desktop, but some of them consume about 40MB of memory just to hide the desktop. So here's my easy, free, and RAM-conserving solution:

In the Finder, create a new folder somewhere on your hard drive. Size it to fill the screen, set the view to Icons, set the View Options to use a background color of your choice, and hide the toolbar. Close the folder. Now, whenever you need the background hidden, just open your maximized folder.

[robg adds: I use either Backdrop or Desktop Cutain to hide the desktop -- they take anywhere from 10MB to 20MB of real RAM. I used to use the folder method, but found that I wanted the added features of the application solution (it's simpler to toggle between colors and images; set the level at which the hiding occurs; etc.). To me, that's worth the 15MB or so of real RAM it requires.]
  Post a comment  •  Comments (16)  
  • Currently 2.40 / 5
  You rated: 2 / 5 (5 votes cast)
 
[11,091 views]  View Printable Version
10.4: Compact sparse disk images via contextual menu Desktop
The following Automator workflow will simplify compacting a sparse disk image. You need to occasionally compact sparse disk images, because while they will grow automatically as you add files, they won't shrink when you delete files. Open Automator in Applications Folder, and create this workflow:
  1. Finder Library » Get Specified Finder Items Action
  2. Finder Library » Filter Finder Items, and select Name Extension is equal to sparseimage.
  3. Automator Library » Run Shell Script and select Pass input as arguments and replace the sample script with hdiutil compact $@.
Save as Plugin for Finder (name it Compact Sparse Disk Image). In the Finder, select a sparse disk image and ctrl-click, go to the Automator entry, and select Compact Sparse Disk Image. That's it!
  Post a comment  •  Comments (14)  
  • Currently 2.17 / 5
  You rated: 5 / 5 (6 votes cast)
 
[14,304 views]  View Printable Version
10.4: Create new blank text files via contextual menu Desktop
Whenever I open TextEdit (rarely), I am dismayed to find out that when I save the file, it only gives me four choices: RTF, HTML, Word, and Word XML. But what happens when I don't care about the formatting, and all I want is plain old txt? For a while I found myself opening a blank text file on my desktop downloaded from a website and then doing File » Save As, or even opening up Terminal and typing in touch Desktop/file.txt.

Well, today I got off my lazy butt and wrote a script (two lines of code). I then put it into Automator and saved it as a plug-in in the Finder's contextual menu. Here's the script:
do shell script "touch ~/Desktop/file.txt"
do shell script "open ~/Desktop/file.txt"
What the script does is first create a file named file.txt and puts it on the desktop, then opens it in TextEdit. I suppose someone could save the script as an application and have it open on a keyboard shortcut through Butler or Quicksilver as well. Just copy the code into Script Editor or Automator in a Do Shell Script action.

[robg adds: There are third-party tools that make this process pretty simple, too. DocumentPalette and NuFile are two that come to mind.]
  Post a comment  •  Comments (14)  
  • Currently 3.33 / 5
  You rated: 4 / 5 (6 votes cast)
 
[40,434 views]  View Printable Version
Add a 'Go to Parent Folder' button to the toolbar Desktop
One detail that I'm actually missing from Windows is a Finder toolbar button to jump one folder up in the hierarchy, ie to the parent folder. So I came up with the following ugly but still functionally work-around. First create an AppleScript app with just this line of code:
tell application "Finder" to set target of window 1 to the container ¨
of target of window 1
Then save it as an application, and quit Script Editor. Now show the contents of the application package you just created by control-clicking on the folder and then choosing Show Package Contents from the pop-up menu. Open the Contents folder and edit the info.plist file in your editor of choice. Adding the following will make the program faceless, so that it does not appear in the Dock when launched:
<key>NSUIElement</key>
<string>1</string>
Finally create a nice icon (I made one in Photoshop that looks similar to the navigation buttons, as seen above right), paste it onto the app (in its Get Info window) and drag the app to the Finder toolbar. Done! It looks a little strange when the window is inactive (the icon gets dimmed, differently from the other buttons), but it does work.
  Post a comment  •  Comments (38)  
  • Currently 2.60 / 5
  You rated: 2 / 5 (5 votes cast)
 
[35,765 views]  View Printable Version