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

An AppleScript to ease fast user switching System
With kudos here and there, I now present my working version of an easy Fast User Switching AppleScript that switches passwords with a double-click, and even types the password for you.
  1. Enable support for Assistive Devices in the Universal Access System Preferences panel.
  2. Change the password string to the password of the user account you want to switch to.
  3. Name the script like the short username of the user you wish to switch to.
  4. Save the script as an executable, to allow easy double-click operation.
I use two users (with the same password) on my computer for different usage types (one for general stuff, the other for music production). I keep two versions of the script in the Applications folder, each assigned to one user. In this way, I just have to type the user name I want to switch to in Spotlight, press Return, and voila.

The script: For your convenience, I've also created an AppleScript application bundle version (32KB download), complete with icon. Just open like a normal Script in Script Editor (in 10.5 at least), put in your password, rename to the short user name, and enjoy the icon.

[robg adds: I haven't tested this one, and note that storing account passwords in a plain text file on your drive is at least something of a security risk. You could mitigate that issue somewhat by keeping your scripts on an encrypted disk image, though this will make using the scripts a bit less convenient.]
  Post a comment  •  Comments (7)  
  • Currently 2.38 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (8 votes cast)
 
[18,286 views] Email Article To a Friend View Printable Version
Automatically eject/mount disks on sleep/wake System
Using a laptop with permanent external drives can be a bit annoying when you leave the desk -- you have to manually eject all your devices, otherwise you get that dreaded 'Device Removal' dialog. With a little bit of Terminal magic, though, you can automatically eject disks when you sleep the laptop, meaning you can just put the lid down and go. Disks are also reconnected automatically on wake, for when you're just sleeping the computer without going places.

It's all thanks to a little utility by Bernhard Baehr called SleepWatcher, which runs in the background and is triggered by sleep and wake events, calling scripts to perform required actions. Download and install SleepWatcher and its StartupItem. Next, you're going to create ~/.sleep and ~/.wakeup files which SleepWatcher will call upon.
read more (137 words)   Post a comment  •  Comments (15)  
  • Currently 2.86 / 5
  You rated: 2 / 5 (14 votes cast)
 
[63,177 views] Email Article To a Friend View Printable Version
View Spotlight indexing task's percentage completion System
This hint is perhaps obvious, but I didn't see it anywhere and it can be useful to know.

If you click on the Spotlight menu bar icon, it will tell you what it estimates the remaining time to create the index will be (i.e., "About 5 hours remaining"). If you hover your mouse over the Spotlight menu bar icon, however, it will tell you a percentage completion figure instead ("Indexing volumes. (6% done)").

A percentage can be nice because OS X's estimate isn't always that good.
  Post a comment  •  Comments (1)  
  • Currently 1.86 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[8,236 views] Email Article To a Friend View Printable Version
Manually specify desired timeserver System
It did not occur to me until now that it actually is possible to edit the server field in the Date & Time preferences window and that it is thus possible to use any timeserver one would want to use -- not just those provided by Apple. Just select the existing text and type the address of the server you want to use.
  Post a comment  •  Comments (11)  
  • Currently 1.83 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[19,470 views] Email Article To a Friend View Printable Version
Remove anti-aliasing from accessibility zoom System
Normally when you use the zoom feature it interpolates pixels so that at high zooms it looks incredibly blurry. However, the key-combination Option-Command-\ will turn off this feature so that you can zoom fully without blurriness.

[robg adds: This is documented in one of the choices on the Options screen of the Zoom section of the Seeing tab of the Universal Access System Preferences panel. But I'm not sure how many folks have ever drilled down into that panel, so I decided to run this one...]
  Post a comment  •  Comments (4)  
  • Currently 1.67 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[7,196 views] Email Article To a Friend View Printable Version
Insert non-breaking spaces System
I'm not sure how far back this goes, but on Leopard at least, pressing Option-Space on the US or US Extended keyboard layouts inserts a non-breaking space (U+00A0) rather than a normal space (U+0020). This might be useful for some people; unfortunately there seems to be no simple shortcut for inserting non-breaking hyphens on either of these two keyboard layouts.
  Post a comment  •  Comments (8)  
  • Currently 2.33 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (6 votes cast)
 
[20,406 views] Email Article To a Friend View Printable Version
Run scripts via the Script Menu via keyboard System
I work with image files and I have many scripts and Automator workflows to handle and modify them. Lots of these actions are assigned to Quicksilver keyboard shortcuts, as I hate using the trackpad. Unfortunately it's difficult (for me) to remember all the keys, and I'm also running out of keyboard! So this tip assigns a keyboard shortcut to the script icon in the menu bar, and allows you to easily select the scripts/workflows within by keyboard. It will work with most apps.

First, open AppleScript Utility in /Applications » AppleScript, and activate Show Script Menu in menu bar and Show application scripts at: top. Then, holding Command, drag the Script icon in the menu bar as far left as you can (it won't go past certain installed apps' icons).

Next, in the Keyboard Shortcuts tab of the Keyboard & Mouse System Preferences panel, enable (and change if desired) the shortcut for Move focus to status menus in the menu bar (in the Keyboard Navigation section; I used command-F2). This shortcut will now open the Scripts menu (because it's leftmost) first from within most apps.

Download Add Front App to Menu.scpt. Open the script. This creates a folder for Script Editor in ~/Library » Scripts » Applications. Then move the Add Front App to Menu script to ~/Library/Scripts. Using the menu bar script menu, you can now add a script folder for any frontmost app to ~/Library » Scripts » Applications. Let's add the Finder first. Make sure Finder is frontmost, then run that script from the Scripts menu.

Now (nearly there) copy some Finder-friendly scripts or workflows to ~/Library » Scripts » Applications » Finder, and rename them so the first character of each is unique. This way, when the menu bar script menu is open, you can highlight the right script with just one key press. If you have lots of scripts starting with the same word or letter, put a different number at the front of each filename, e.g. file-jpg.scpt and file-png.scpt become 1file-jpg.scpt and 2file-png.scpt. Now you can run any number of scripts or workflows in just three key presses -- and without having to remember lots of shortcuts. Happy button pushing!
  Post a comment  •  Comments (15)  
  • Currently 1.80 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[27,744 views] Email Article To a Friend View Printable Version
Display system uptime in a Finder dialog System
I was thinking that there must be an easier way than going to Terminal and typing uptime in order to find out how long my machine had been up. So I wrote a wee AppleScript that gives the answer in the form of a Finder dialog window. Stick this into Script Editor, and save it as Application (or Application Bundle).
set output to do shell script "uptime"

tell application "Finder"
    display dialog output buttons {"OK"} default button 1
end tell
If you wish, you can then add a shortcut to it from your launcher. Voila, uptime and load averages at your findertips (literally).

[robg adds: This is a very simple hint, but one that demonstrates to new AppleScript users how to display the output from any Terminal command in a dialog. For uptime, and many other Terminal commands whose output I'd like to see on occasion (such as the results of the last Time Machine backup), I use GeekTool, as described in this Pick of the Week entry. (And yes, that feature will return in some form shortly...).]
  Post a comment  •  Comments (7)  
  • Currently 1.60 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[14,804 views] Email Article To a Friend View Printable Version
Change the default text for just about everything System
This is a hint which will allow you to change the default text for just about anything. This is actually quite easy -- all you need to do is edit various *.strings files. The thing is, these .strings files can be found just about everywhere. Here are some good places to look:
  • /System » Library » CoreServices/
  • Control-click on an application, choose Show Package Contents on the pop-ip menu, then navigate into Contents » Resources » [your language].lproj.
A few points:
  • If the string you replace is too long, it will just be truncated and look a bit odd.
  • Some strings don't appear to work anyway. I've no idea why.
  • The strings files have comments in them. For example, search for OD_8 in /System » Library » CoreServices » Finder.app » Contents » Resources » English.lproj » Localizable.strings.
  • Many applications will need to work on a copy, as they cannot authenticate a save.
  • %@ is often an interesting thing to try.
  • To insert a quotation mark, use \\", and to insert a backslash, use \\\.
Read on for an example to get you started...
read more (229 words)   Post a comment  •  Comments (13)  
  • Currently 1.80 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (5 votes cast)
 
[9,292 views] Email Article To a Friend View Printable Version
Use Terminal's vi as default text editor System
I've always been a vi guy, but OS X GUI-based vi versions leave a lot to be desired. So for years I've put up with TextEdit as the default application when I double click a text file in Finder or an attachment in Mail. Until yesterday, that is. Using this old macosxhints forum thread as the base, I updated and modified the script to behave properly.

Double-clicking a text file now opens it in vi in a new tab in Terminal, opening Terminal if it's not already running (which is rare, as I usually have four or five tabs open all the time). Here's the script: Copy it into Script Editor, and save it as an Application called VI. To use your new application to open any text file, control-click on a text file and choose Get Info from the pop-up menu. Under Open With, at the bottom of the pull-down menu, is Other. Select that, and a window will open where you can choose your saved application (check the Always Open With box, too). I also checked the Change All box back in the Get Info window.

Unfortunately, the one thing I haven't figured out is how to get it to open without an input file, so to start a new text file I have to go to the Terminal and type vi filename. Please let me know if this script can be improved to handle that case, or in any other ways.

[robg adds: While I could make this script work for files on a one-at-a-time basis, I could not get the Change All solution to work -- regardless of how I specified the app, or set the file's extension, Change All had no effect. Only the selected file was modified to open with vi; a commenter on the queue review site had the same experience. If you know how to resolve that issue, please comment...]
  Post a comment  •  Comments (16)  
  • Currently 2.29 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (7 votes cast)
 
[39,125 views] Email Article To a Friend View Printable Version