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

Show random desktop picture immediately on login Desktop
You can select a folder or iPhoto album in the Desktop subpane of the Desktop & Screen Saver System Preferences panel and tick the Random Order checkbox. This works fine until you logout / login or restart -- then the image defaults back to the Lightning picture until the next 'change picture' interval occurs.

For example, if you have Change Picture set to Every Day, on restart you won't see a picture from your chosen folder until up to 24 hours later. Meanwhile you're stuck with the default (IMHO, ugly!).

Solution? Go into the preferences pane, untick and retick the Random Order box, and your desktop is refreshed with a new random image. You can automate with a short applescript and add it to Accounts » Login Items:
tell application "System Events"
  tell current desktop
    set random order to false
    set random order to true
  end tell
end tell
This bug has persisted on several of my machines through 10.5.7.

[robg adds: I don't see this issue on my laptop, which is presently booting between two OSes regularly -- when restarting in 10.5.7, one of my random images comes up. However, if it's happening to you, this is a pretty simple workaround.]
  Post a comment  •  Comments (8)  
  • Currently 2.30 / 5
  You rated: 5 / 5 (10 votes cast)
 
[7,751 views] Email Article To a Friend View Printable Version
10.5: How to increment trailing digits in copied files' names Desktop
In the Finder, there are numerous ways to duplicate a given file: either copy and paste the file to the same place, Option-drag the file to the same folder, or Control-click on the file select Duplicate from the contextual menu (or just press Command-D in the Finder).

Interestingly, the behavior of renaming the copied file for these three commands differs slightly. While duplicating or copying and pasting appends copy to the end of the filename (unless it already ends in copy, in which case it begins to enumerate) option-dragging the file to the same folder results in a slightly more useful naming system.

If the original file does not end in an integer, the new filename will be appended with the number 2 instead of copy. If the original ends in an integer, however, Finder does something quite useful -- instead of appending 2 to the end of the file, it recognizes the integer and adds one to the value.

For example, Report.doc will be renamed to Report 2.doc, but Report Number 67.doc will be conveniently renamed to Report Number 68.doc.

[robg adds: This is marked 10.5 only as I believe this behavior was new in OS X 10.5.]
  Post a comment  •  Comments (8)  
  • Currently 1.89 / 5
  You rated: 5 / 5 (9 votes cast)
 
[6,786 views] Email Article To a Friend View Printable Version
Create a new Sticky widget from entered text Desktop
The following AppleScript asks you for some text, copies it to the clipboard, then creates a new Sticky widget and pastes the text you entered. Here's the code: The two delay lines may need adjustment for different systems; experiment to find what works for you. Once you have the script working, use something like Fastscripts, QuickSilver, Proxi, QuicKeys, etc. to assign it a keyboard shortcut for fast activation. This should work in either Tiger or Leopard.

[robg adds: This worked for me as described on my Mac Pro (no editing of the delays was required).]
  Post a comment  •  Comments (11)  
  • Currently 2.33 / 5
  You rated: 2 / 5 (9 votes cast)
 
[11,673 views] Email Article To a Friend View Printable Version
Flatten a folder's structure via AppleScript Desktop
The following AppleScript traverses the currently-selected folder in the Finder, moves the contents of all subfolders of that folder up to the top level, then moves the (now empty) subfolders to the trash. [robg adds: Copy and paste the above into Script Editor, then switch to the Finder, select a folder, switch back to Script Editor, and press Run. Because this script is non-reversible, I strongly recommend first using it on a non-critical test folder -- a duplicate of the folder you intend to flatten, for instance. That's how I tested it, and it worked as described (at least in 10.5; I don't know if it will run in 10.4). If this is something you do often, you could save the script to your user's Library » Scripts » Applications » Finder folder, where it'd be available from the Scripts entry in the menu bar.]
  Post a comment  •  Comments (20)  
  • Currently 2.10 / 5
  You rated: 1 / 5 (10 votes cast)
 
[12,423 views] Email Article To a Friend View Printable Version
Set desktop pictures using AppleScript Desktop
This hint was inspired by a study that found red wallpaper conducive to detail-oriented work, while blue wallpaper works better for creative work. Based on that, I wrote a simple AppleScript to display a dialog that allows the user to choose between working environments. The script then sets the desktop picture based on the user's selection.

Note that this hint assumes you've already created the new solid colors (very dark gray, very dark blue, and very dark red) as explained in this previous hint. Once you have those colors (or others, if you prefer; just change the script as necessary), create the following AppleScript: [robg adds: I tested this, and it works as described. If you want to use more colors, you need to change both the buttonList and colorList lines so that they remain in sync. The list of colors in colorList must exactly match the colors' filenames as seen in the Finder.]
  Post a comment  •  Comments (8)  
  • Currently 1.88 / 5
  You rated: 3 / 5 (8 votes cast)
 
[14,427 views] Email Article To a Friend View Printable Version
Sort files into subfolders based on date added Desktop
There are many published methods to put files in named folders based on date created or modified, but this one puts them in corresponding folders based on the date the file was added to the folder, similar to the sorting option for stacks in the Dock -- I use this to organize my Downloads folder.

The following AppleScript works by exploiting the HFS+ inode table, and retrieves the date which the file's name was added to the directory tree, regardless of when it was previously modified or created in other locations.
tell application "Finder"
    set mifold to choose folder
    set filelist to every file of mifold as list
    set foldlist to every folder of mifold as list
    repeat with i from 1 to number of items in filelist
        set subj to item i of filelist as alias
        set epoch to (do shell script "stat -f \"%B\" " & (quoted form of (POSIX path of subj)))
        set caldate to do shell script ("date -r " & epoch & " \"+%Y-%m-%d\"")
        
        if not (exists folder caldate of mifold) then
            make new folder at mifold with properties {name:caldate}
        end if
        try
            (* try ignores errors from locked files *)
            move file subj to folder caldate of mifold
        end try
    end repeat
    repeat with j from 1 to number of items in foldlist
        set subj to item j of foldlist as alias
        if name of subj does not start with "200" then
            set epoch to (do shell script "stat -f \"%B\" " & (quoted form of (POSIX path of subj)))
            set caldate to do shell script ("date -r " & epoch & " \"+%Y-%m-%d\"")
            if not (exists folder caldate of mifold) then
                make new folder at mifold with properties {name:caldate}
            end if
            try
                (* try ignores errors from locked items *)
                move folder subj to folder caldate of mifold
            end try
            
        end if
    end repeat
end tell
It could probably use some optimization, so feel free to make suggestions if you're an AppleScript geek!

[robg adds: This works as described, at least on the folders I tested it with. Note there's no going back, of course, so if you run the script, you'd have to manually restore the flat folder structure if you change your mind. A couple of other hints in this category include organizing the Downloads folder by download date (which changes the files' modifications times to re-sort them) and using Hazel to sort items in folders (among its other features).]
  Post a comment  •  Comments (3)  
  • Currently 2.13 / 5
  You rated: 5 / 5 (8 votes cast)
 
[13,679 views] Email Article To a Friend View Printable Version
10.5: Change folder sort order in the Finder's Kind view Desktop
Note: This hint was lost when the site was hacked on April 23rd. I've reposted it, and the comment thread, as best as I could. --robg

In the Finder's list view, if you sort by Kind, folders are lumped together in the middle of the list. If you'd rather see all the folders at the beginning of the list, here's how to change the sort order. In the Finder, navigate to /System » Library » CoreServices » Finder.app » Contents » Resources » English.lproj (or the folder for your language). In that folder, open the InfoPlist.strings file in a pure text editor. Inside the file, find this section and entry:
/* General kind strings */
"Folder" = "Folder";
Leave the first line alone, but change the second to read:
"Folder" = " Folder";
Note that I have added only a single space before Folder. Save the file after making the change, and then restart OS X. To test your change, open a Finder window and view by Kind (either via View » Show View Options, or by pressing Command-2, then clicking on the Kind column header).

robg cautions: As noted in the comments, this hint will break OS X 10.5's code signing for the Finder. In theory, this will have some bad consequences, as you'll no longer be able to access the keychain when using the Finder. Proceed at your own risk; if you undo the edit, at least based on my testing, things will return to normal (code signing checks will pass).

[robg adds: This is an update to this much older hint, which required modifying a system-wide framework. Note that restarting isn't required; just restart the Finder via Terminal, Activity Monitor, or Option-click-and-hold its Dock icon.

If you want folders at the end of the list, instead of the beginning, you'll have to use one of a few special characters:
  • µ (mu): Option-M
  • π (pi): Option-P
  • Ω (omega): Option-Z
  •  (Apple): Shift-Option-K
I also did a bit of experimenting with the Edit » Special Characters palette. Most any Greek letter (European Scripts » Greek in the All Character view) will force a name to the end of the list, as will some Cyrillic characters. But that's about it; pretty much everything else I tested forced the names to the front of the list.]
  Post a comment  •  Comments (15)  
  • Currently 2.30 / 5
  You rated: 4 / 5 (10 votes cast)
 
[23,657 views] Email Article To a Friend View Printable Version
10.5: Retain positions when moving windows in Spaces Desktop
Today I noticed that you can force Spaces to move windows to another Space while retaining their relative position on the screen. To do so, open the Spaces overview (F8 by default), and hold the Command key while dragging a window to another Space.

I found this by accident and don't think it's that useful, but perhaps you will...

[robg adds: This was mentioned in a comment to this hint, but I thought it worth sharing as a real hint. In testing it, the behavior varies between programs with one window (iCal) and those with many windows (iChat, Safari, whatever). If a program has but one window, then Command (or Shift or Control) will move it while retaining its location. If a program has multiple windows, any of those keys will move all of that program's windows while retaining their positions. I couldn't, in fact, find a way to move all windows of a program to another Space without retaining their positions -- I had to manually move them within the new Space (again, while holding any of those keys so that all windows moved) to change their position.]
  Post a comment  •  Comments (11)  
  • Currently 2.13 / 5
  You rated: 2 / 5 (8 votes cast)
 
[8,428 views] Email Article To a Friend View Printable Version
Move selected items into ready-to-rename folder Desktop
This is a simple AppleScript for the Finder which moves the currently selected items into a newly-created folder, and puts the new folder into rename mode. I use this to quickly sort my files into properly-named folders.
(*
Move items into new folder
Author: Barry Els
Version: 1.1
*)

tell application "Finder"
  try
    
    set theSelection to selection
    
    set currentPath to ((the first item of the theSelection) as alias)
    set parentPath to currentPath
    
    if (currentPath as string) ends with ":" then -- it is a folder
      set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
      set the parentPath to (text items 1 thru -3 of (currentPath as string)) as string
      set AppleScript's text item delimiters to od
    else -- it is a file
      set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
      set the parentPath to (text items 1 thru -2 of (currentPath as string)) as string
      set AppleScript's text item delimiters to od
    end if
    
    try
      
      set newFolder to (my createFolder(parentPath))
      move theSelection to newFolder
      
      delay 0.1
      set selection to newFolder
      tell application "System Events"
        keystroke return
        quit
      end tell
      
    end try
    
  on error
    (*
    no folder or file is selected, warn the user
    *)
    
    display dialog ("Please select one or several items to group" & (theSelection as string))
    
  end try
  
end tell

on createFolder(selectedPath)
  tell application "Finder"
    set createdFolder to make new folder at selectedPath
  end tell
  
  return createdFolder
end createFolder
After saving the script, you'll want to use a keyboard shortcut tool (I use Spark) to run this script via the keyboard -- I've set the key combo for this one to Command-G.

[robg adds: This worked as described in my testing.]
  Post a comment  •  Comments (19)  
  • Currently 1.63 / 5
  You rated: 2 / 5 (8 votes cast)
 
[9,994 views] Email Article To a Friend View Printable Version
10.5: Put Smart Folders under Places on the Sidebar Desktop
If you are like me, you have a lot of entries in the Places section of the sidebar in Leopard's Finder. What if you want a Smart Folder that aggregates your favorite/recent places (or provides any Smart Folder functionality), but you don't want to have to scroll down to the Search For section of the sidebar? In other words, you'd like to place your Smart Folders in the Places section of the sidebar.

By default, Apple disables moving Smart Folders to the Places category of the sidebar. So how do you get around this? Easily.

Take any saved search on the sidebar, Control-click on it and select Open Enclosing Folder from the pop-up menu. Then select your search and choose File » Make Alias, and drag the alias to your sidebar. Done!

[robg adds: I think this can be further simplified -- once the enclosing folder is visible, you can drag any of the visible Smart Folders directly to the Places section of the sidebar; no alias is required (at least not on my 10.5.6 machine it's not).]
  Post a comment  •  Comments (6)  
  • Currently 2.45 / 5
  You rated: 5 / 5 (11 votes cast)
 
[13,042 views] Email Article To a Friend View Printable Version