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

Poor-man's AppleScript vocalizer System
A bad cold has temporarily robbed me of my voice, so I decided to pay homage to Stephen Hawking and whip up a poor-man's vocalizer. More fun than function here, but it did let me order my latte at Starbucks without pain, and with a great many laughs all around.

Run this from the AppleScript Editor, save it to the Scripts Menu, or save it as an Application; whatever method works best for you.
property currentVoice : "Vicki"
set systemVoices to {"Agnes", "Albert", "Alex", "BadNews", "Bahh", "Bells", "Boing", "Bruce", 
 "Bubbles", "Cellos", "Deranged", "Fred", "GoodNews", "Hysterical", "Junior", "Kathy", 
 "Organ", "Princess", "Ralph", "Trinoids", "Vicki", "Victoria", "Whisper", "Zarvox"}

 activate me
 set theResult to display dialog "Say What?" default answer 
  "" buttons {"Quit", "Speak", "Change Voice"} 
  default button "Speak" cancel button "Quit"
 if button returned of theResult is "Quit" then
  exit repeat
 else if button returned of theResult is "Change Voice" then
  set currentVoice to item 1 of 
   (choose from list systemVoices with prompt "Choose new voice.")
 end if
 if text returned of theResult is not "" then
  say text returned of theResult using currentVoice volume 1
 end if
end repeat

[crarko adds: I tested this, and it works as described. I thinks it's a simple and clever usage of a well-known Mac feature.]
  Post a comment  •  Comments (7)  
  • Currently 3.00 / 5
  You rated: 3 / 5 (6 votes cast)
[4,323 views]  View Printable Version
Bulk convert text files to PDF System
Here is a quick AppleScript droplet to bulk convert text files (plain text, rich text, html, some code files like C and javascript files...) to PDF format.

Copy the following script into the AppleScript Editor (/Applications/Utilities/AppleScript Editor) and save it as an application.

Then drag-and-drop files onto it to convert them to PDFs.
on open theFiles
  set oldTID to AppleScript's text item delimiters
  repeat with thisFile in theFiles
    -- get file path as posix path
    set inputFilePath to POSIX path of thisFile
    -- create output path - same name with .pdf extension
    set AppleScript's text item delimiters to "."
    set outputFilePathBits to text items of inputFilePath
    set last text item of outputFilePathBits to "pdf"
    set outputFilePath to outputFilePathBits as text
    -- create convert command and send to shell
    set AppleScript's text item delimiters to " "
    set cmdList to {"/System/Library/Printers/Libraries/convert", "-f", quoted form of inputFilePath, "-o", quoted form of outputFilePath}
    do shell script (cmdList as text)
  end repeat
  set AppleScript's text item delimiters to oldTID
end open
The new PDF files will be put in the same folder as the originals.

The convert utility is not well documented (enter /System/Library/Printers/Libraries/convert without options in Terminal to see the brief help menu), but it's really just a front-end for the cupsfilter utility, which has better documentation. If you're a CUPS expert you might be able to do more with it than this, but for simple conversions this does nicely.

[crarko adds: I tested this, and it works as described.]
  Post a comment  •  Comments (17)  
  • Currently 2.67 / 5
  You rated: 2 / 5 (6 votes cast)
[15,510 views]  View Printable Version
GUI script to reboot a Windows partition back to an OS X partition System
You can use AutoIT, a free basic-like GUI scripting application to automate the bootcamp.exe in Windows to force a reboot back into OS X.

This is sort of part 2 to my previous hint found here. This AutoIT script can be automated by whatever mechanism you use to manage a Windows partition on your Macs, like Active Directory, Citrix, Novell/Netware, SCCM, or other third party tools to run scripts and policies in your enterprise.

It basically just opens the Boot Camp executable file in Windows and then simulates mouse clicks. This is how I forced users back into OS X after non admins would boot into Windows. Here is the script:
;; boot_to_osx.au3
;; there's no way to do this with the command line or anything,
;; so here's a little autoit script to use apple's provided
;; utility to bless the OSX drive.
Local $dom = envget("USERDOMAIN")
WinWait("Boot Camp Control Panel")
WinActivate("Boot Camp Control Panel")
WinWaitActive ("Boot Camp Control Panel")
ControlClick ("Boot Camp Control Panel", "", "[CLASSNN:SysListView321]", "left", 1, 40, 20)
ControlClick("Boot Camp Control Panel", "OK", 1)
Run("C:\Windows\system32\shutdown.exe -f -r -t 0")
You can find the AutoIT software from their site, and it is a free product. In our case we had Zen Works auto launch and monitor our testing application that users needed to use Windows on. Once that process was terminated in any way at all, the AutoIT script kicked off and forced a user back into OS X. We only wanted our users using Windows for that single application and nothing else.

[crarko adds: I haven't tested this one.]
  Post a comment  •  Comments (3)  
  • Currently 3.33 / 5
  You rated: 5 / 5 (6 votes cast)
[4,126 views]  View Printable Version
Tweak Dashboard widget use to improve performance System
If you notice your Mac is running very slowly, or if you begin to see a marked slowdown in your Internet browsing performance, it is possible a Dashboard widget could be the problem.

My Mac had been running slowly for weeks. Things seemed to pick up a bit if I restarted the computer, but that was virtually the only thing that seemed to make a difference; I could have just one application running, like Safari or Firefox, and it would slowly begin to slow down. I ran a third-party virus scan, and it turned nothing.

One of the first things I would notice when my Mac began running slow is that each and every time the Dashboard would take forever to load. I searched, and learned that you could clear the Dashboard cache and that that may increase the Dashboard's performance. I did that and that seemed to do the trick -- it was like I all of a sudden had a brand new computer that loaded quickly and ran just like it did when I first bought it. Everything ran smoothly, including the Dashboard application.

But it's what came next that is the real tip here. Clearing out the Dashboard cache meant that I had to open the Widgets Manager and re-open some of my widgets. It was working well, so I downloaded and installed several new widgets.

Within a week the performance issue was back, and things were running very, very slow. But this time around I realized that if the Dashboard cache could create the problem to begin with, that maybe it was the problem again. I had noticed in my research that Dashboard runs along with the Dock, meaning it basically runs constantly. And that means that some widgets that require streaming data to update continuously may cause things to run slowly. When I realized that, it finally made sense why my Dashboard took forever to load and why it was doing so again after having cleaned out my cache.

Before the cache wipe, I had a program running all the time that showed a map of the world and where the position of the sun was at any given minute of the day or night. I had not reopened it after I swiped the cache, so it makes sense why things ran quickly at first. When I looked for new widgets, though, I found a weather radar widget from The Weather Channel that continuously showed a radar map of my local regional weather.

When my computer began running slow the second time (and it was very slow), I went to the Dashboard and deactivated the Weather Channel widget. There was an immediate dramatic improvement in system-wide performance, and I didn't have to restart the computer, restart the Dock, disable the Dashboard, or wipe the Dashboard's cache.

The bottom line: if you are having performance issues -- and particularly if you notice your Dashboard taking longer to load, check to see if you have any Dashboard widgets that could be causing the problem. If you figure out which one is the culprit, you don't have to delete it altogether to fix the problem; just disable it and it will still be in the Dashboard Widgets manager so you can open it if and when you need it. In my case, I can always open that Weather Channel radar widget if I know there's a storm on its way, but the rest of the time it won't be eating up RAM and affecting my entire system's performance.

[crarko adds: There are obviously many possible causes of performance degradation, but a rogue widget can certainly be one of them, like any other background process.]
  Post a comment  •  Comments (6)  
  • Currently 3.00 / 5
  You rated: 2 / 5 (5 votes cast)
[9,835 views]  View Printable Version
Improve usability when dragging items to a hidden Dock System
Many of us have turned on Dock hiding to maximize usable screen area. One small problem with a hidden Dock, however, is that when you want to drag a file onto an application or folder icon on the Dock, you don't always know exactly where to aim, since you can't see the Dock until the mouse is on top of it. As a result, you will usually drag the file to the wrong location on the Dock at first, and you will need to hunt for the correct target, all the while keeping the mouse button down. Sometimes you will even drop the file onto the wrong icon while 'scrubbing' the Dock for the right one.

My solution to this problem is to reveal the Dock with a keystroke after initiating the drag, but before the mouse reaches the Dock area. By doing that, I can visually locate the target icon first, and then drag the file straight to the target. No more scrubbing.

To facilitate doing that, I have assigned an easy-to-use keyboard shortcut to the action labeled 'Move focus to the Dock' in the Keyboard prefpane. By default, this action's shortcut is Ctrl+F3. That's just too cumbersome to type on some Apple keyboards, which lack dedicated function keys. But most of these keyboards have the F5 and F6 keys unassigned to any system function, so they are available for binding to whatever you wish. Either of these keys is a pretty good choice for assigning to this action.

You can find the 'Move focus to the Dock' action in System Preferences » Keyboard » Keyboard Shortcuts » Keyboard & Text Input.

After assigning (for example) F5 to the 'Move focus to the Dock' action, it becomes very easy to reveal the Dock in the act of dragging an item toward it before the mouse reaches the Dock area: just press F5 (or whatever) while dragging.

What would be even better is if some kind software developer would write a program that would automatically reveal the Dock if it detected you were dragging an item in its direction. Until that happens, the keyboard trick described here provides at least a little relief.

[crarko adds: I tested this, and it works as described. On my MacBook, F5 is bound to raising the sound volume, so I tested it using F12, which is also awkward, but it did work.]
  Post a comment  •  Comments (6)  
  • Currently 3.44 / 5
  You rated: 3 / 5 (9 votes cast)
[4,077 views]  View Printable Version
Recovering from a catastrophic drive failure. System
I can't say it enough. Back up your hard drive. I'm going to talk here about what I recommend as the best way to protect yourself from a catastrophic hard drive failure. Keep in mind that what follows is just one of many ways to protect your Mac.

This will cost you. You need to purchase an external hard drive to use with Time Machine. When your internal hard drive fails, you will then need another external hard drive to restore to from Time Machine. You will be using that new external hard drive to work from until you're ready to repair your Mac.

The Time Machine basics:

The size needed for this hard drive depends on how much space you expect to use on your internal hard drive. If you're currently using only about 30GB of your 500GB hard drive and you don't expect to be adding a lot of videos or photos in the future, then you can safely use a 120GB hard drive. In other words, your Time Machine backup drive should be about three times the size of what is being used in your internal drive. You need the extra size because the Time Machine keeps a running history of all the changes you make.

If you want to be able to go back in time by several months to recover a lost file or an older version of a file, you need the extra size. If all you want to do is keep a few days or a few weeks of older versions then an external drive a little larger than what you currently use would be sufficient and save you money. For example, to back up 30GB, use a 80GB hard drive. Good luck finding one that small.

When the Time Machine is disk gets full it just removes the oldest backup to make room for the new backup. Hence, the smaller the external hard drive, the less history you can save. It should be noted that if the Time Machine disk is small, it will need to frequently delete an older backup to make room for a new one, and that takes more time.

The interface for the Time Machine disk can be USB 2.0 or Firewire 400 or Firewire 800. If you don't mind that it takes a long time to perform a backup (many minutes instead of a few minutes) then use USB. Time Machine works in the background. Still, when it does run, it requires computer resources. If you don't like being slowed down a little while Time Machine is running (about every hour), then find a hard drive with a Firewire 400 or Firewire 800 interface (800 is faster than 400) - and be prepared to pay a lot more. Alternatively, turn off Time Machine when you are using the Mac and turn it back on when you're away from your Mac (the Mac has to be on and not asleep for Time Machine to work; the display can sleep, but not the computer).

Here are Apple's instructions for setting up Time Machine. The type of interface to choose for the new external hard drive you intend to use as a temporary startup disk is up to you.

Recovering from a failed internal hard drive:

This is rather simple.
  • Make sure your Time Machine disk is connected and turned on.
  • Connect a new external hard drive to the computer and turn it on (same size or larger as the internal drive).
  • Insert your Mac OS X Install media in the CD/DVD drive.
  • Hold down the C key when you press the power button. The computer will boot up from the install media in the CD drive.
  • When the Language Chooser appears, select your language, and then click the Continue button.
  • In the Installer, choose Utilities » Restore System From Backup.
  • Select the Time Machine disk and click Continue.
  • Select the latest backup from the Time Machine disk.
  • Follow the onscreen instructions to select the new external hard drive to restore to.
  • Be patient while the restore takes place.
What if you can't find your Mac OS X Install media? Then you will need a clone of your internal hard drive to boot up from. See how to create one here. But be sure to do that before your internal drive fails.

If you used a clone instead of the Install media to boot up from, you only need to restore everything from the latest backup of the Time Machine to the clone. Do that after you boot up from the clone the first time.

Booting up from the new external hard drive:
  • Hold down the Option key while you press the power button and keep it held down until the Start Up Manager appears.
  • When the Start Up Manager appears, select the new external hard drive to boot from.
  • When the computer is up and running, open the System Preferences.
  • Select the Startup Disk icon in the fourth row of icons.
  • From the available disks showing, select the new external hard drive as your new system startup media.
  • Restart the Mac.
  • Each time now that you start up the Mac, it will boot from the external drive without having to do anything special.
You are now ready to use your Mac as though nothing happened. But don't forget to turn in your Time Machine disk with the computer (you won't need to also turn in your new external hard drive) when you are ready to have the internal hard drive replaced. Make sure you force a backup on the Time Machine just before turning off the Mac. The repair center will use the Time Machine disk to restore to the new internal hard drive.

Play safe so your Mac won't disappoint you. You can print out this note for future use.

[crarko adds: OK, this is not groundbreaking news to those of us who have been supporting Macs for a while, but once again for the benefit of the newer users it's nice to have step-by-step guides. I've had to do this kind of recovery for Windows desktops and servers and I once again marvel at how fortunate we are to be using Macs.]
  Post a comment  •  Comments (5)  
  • Currently 4.20 / 5
  You rated: 4 / 5 (5 votes cast)
[21,812 views]  View Printable Version
Temporarily disable automatic login System
This hint is for programs like Undercover and others.

If your Mac is stolen, you need to provide a way for the thief to login in your computer, so those programs can track your Mac, otherwise you are in trouble.

Perhaps you didn't put a password in your account to allow autologin. But this isn't secure enough. Or you need to create a guest account to allow the login, so you can put a password in your main account.

The problem is that every time your machine boots, you need to choose your user. It would be handy if your guest account would login by itself. But then you would need to logout first and after that login in your main account.

You just need to press and hold the Shift key during the boot ONLY when the Blue screen appears. It will disable autologin and you can choose between your accounts.

So you can put a password in your account, and enable the automatic login for the guest account.

To recap:
  • Create a guest account and ENABLE automatic login for this account.
  • Put a password in your main account
  • At every boot ONLY after the blue screen appears press and hold SHIFT, it will disable autologin, otherwise you Mac will login with guest account for the thief and your tracking programs can do their job.

[crarko adds: I haven't tested this one. I think the need to login to the machine is the great weakness of some of these anti-theft programs. I hope when Apple implements the 'Find My Mac' option in Mobile Me this is not a requirement, but just that the machine can find a nearby open WiFi network to grab and send a location.]
  Post a comment  •  Comments (5)  
  • Currently 3.75 / 5
  You rated: 5 / 5 (8 votes cast)
[12,406 views]  View Printable Version
High resolution screen captures System
Sometimes I want to get a higher resolution screen capture so I can include it in a printed document. Although my monitors are big, if I stretch a window out very large, that doesn't make the text, buttons, or menus bigger. This hint tells you how to scale the window itself, so you get a better screen capture.

Here's the problem: I want a screen capture with as many real, useful pixels in it as possible. If I have a window, say the Eclipse IDE, that looks good when it's, for example, 1000x800 pixels in size, it tends to just fill up with white space if I stretch it out to 1600x1050 (the size of my monitor). Certainly the icons and such don't scale.

If I take a screen capture of the 1000x800 pixel window, and then I scale it using a raster graphics program, the text gets scaled and jaggy, along with the UI elements. For many programs I find it time consuming and annoying to try to change all the fonts and preferences to make the text larger, and even if I do, the UI elements will be out-of-proportion to the text.

Instead I make use of this hint for a different purpose. You'll need to have Xcode installed to do this.

I open Quartz Debug (from /Developer/Applications/Graphics Tools/) and choose 'UI Resolution' from the Window menu. Then I slide the slider up to 1.25 or maybe 1.5 and stop. Now when I launch the program I want to capture, it is much bigger. Of course, the icons may look a bit blocky and some of the UI elements don't look right around the edges, but I've scaled everything uniformly. The fonts will scale smoothly and most of the UI elements scale smoothly. It has a much better look than going in and changing the text size to 18pt or 24pt, while leaving all the UI elements alone.

So now, when I make the window 1600x1050, I get more information in my screen capture. It looks better when printed. Fonts are scaled up smoothly and everything is in the same ratio as it normally would be.

[crarko adds: I tested this, and it works as described.]
  Post a comment  •  Comments (8)  
  • Currently 4.40 / 5
  You rated: 5 / 5 (5 votes cast)
[27,610 views]  View Printable Version
Startup freeze after migrating to new i7 iMac System
Hopefully this will same someone out there some time and hair pulling. I was migrating from a 2x2 Xeon @ 3ghz to a new i7 iMac. After Migration and restarting the iMac started freezing before getting to the blue screen. Since Apple couldn't get a support call to me right away I decided to do some poking around. Using Safe Mode booting and removing start up items I found the problem.

Since my understanding of the OSX system is very limited, this took me a long time to work out. Anyone with a sense of how OSX works probably would have known what to do immediately.

The system was hanging right after the Apple logo appeared and the spinner finished its spinning long after the start up chime. Instead of going blue, then to the desktop the screen stayed white. The first time I got the curtain of gray with a 'I need to restart my computer' message in several languages every time at this point. [crarko adds: We call this a Kernel Panic in Mac land.]

The computer DID boot up in 'Safe Boot' mode (holding the Shift key down) fine. I used a USB keyboard as I didn't trust the Bluetooth setup so I can't swear that it'll work with a BT keyboard.

I suspected there were some startup items that didn't work with my new system, but what I didn't understand why is this an issue before I log in? The only startup items that I was aware of existed in the user preferences, and this hang was before any user was logged in. So I searched around for start up items and found /Library/Startupitems/Resources which had a few items in it. For whatever reason there is another Startupitems folder at /System/Library/Startupitems which is empty. I moved the items from the /Library/Startupitems/Resources folder to a temporary folder on my desktop and hit Restart.

With fingers crossed (and eyes too) I selected 'Restart' and the computer booted fine! Slowly I added items back to the folder and restarted. Now I have everything back except for all Cocktail related items, and a folder BRESINKx86Monitoring which was part of a CPU temp monitoring app I had.

Like I said, my understanding of OSX is that of a user, so I might be mistaken as to how/why this all worked. It took me a while to figure it out, but since my old system was fine and I had time there was nothing to lose. The fact that the OS has folders labelled 'startupitems' really helped. IIRC searching for 'startupitems' didn't work in safe boot, so I was looking around on my own.

[crarko adds: I post this, not because it's going to be new information for the veteran Mac user (most of us have been through things like this) but as a reminder of what the new Mac user may experience, since we have a lot of them. I'm hoping some of the more experienced members will continue to provide good advice for the beginner. I'll also put in a plug for the MacOSXhints forums as a place for new users to go with troubleshooting questions and more in-depth answers.]
  Post a comment  •  Comments (5)  
  • Currently 3.86 / 5
  You rated: 4 / 5 (7 votes cast)
[6,105 views]  View Printable Version
Manually backup and restore a User Home Folder System
When troubleshooting a computer problem sometimes its best to just wipe the hard drive and start fresh. I developed the following method for backing up user home folders so that they can easily be restored to another computer or the same computer while preserving proper permissions, ACLs, and file/folder ownership.

To backup, use Disk Utility (in /Applications/Utilities/) to backup the user home folder.
  • Login as a local administrator, but not as the user account you want to backup.
  • Launch Disk Utility.
  • Choose File » New » Image from Folder...
  • Select the user's home folder /Users/[username].
  • Save the disk image to your backup drive.
  • Enter an admin username and password when prompted.
To restore:
  • When starting with a freshly restored or new computer use the Setup Assistant to create a local admin account that is NOT the same user name and short name as the user you are restoring.
  • Login as that local admin account.
  • Mount the disk image from the backup drive of the user's home folder you want to restore.
  • Switch to the Finder by clicking the Finder icon in the Dock.
  • Choose 'Go To Folder' from the Go menu.
  • Type /Users/ and click Go.
  • Copy the mounted disk image (not the disk image itself, but the white mounted disk image icon on the desktop) to the /Users folder by dragging it and holding the Command key. A green plus sign on the icon will indicate a copy and not a move is about to be performed.
  • When the copy is complete, the user's home folder will be restored with all its sub-folders, and all previous ownership and permissions will be intact.
  • Finally, use System Preferences to create a user account with the same username as the home folder. System Preferences will prompt you to verify you want to use the existing home folder for this account, and then will verify the home folder as having the correct ownership and permissions.

[crarko adds: This is the type of procedure I used before Time Machine automated the process. Before that I used to use ditto in a manner similar to this hint. There are many ways of doing this, but this one is pretty straightforward, and if for some reason Time Machine is not feasible this method will work.]
  Post a comment  •  Comments (16)  
  • Currently 2.88 / 5
  You rated: 1 / 5 (8 votes cast)
[56,021 views]  View Printable Version