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

Create keyboard shortcuts for the Print - PDF menu System
Just stumbled upon this one ... some time ago, I was attempting to write an AppleScript to choose the Save As PDF... option in the Print dialog box of Safari. After searching all of the scripting sites, I worked out a solution, but it was a kludge that involved System Events and "click at" coordinates.

I was playing around with the Keyboard and Mouse Preferences pane, and decided to try adding an Application keyboard shortcut for Safari. I just typed in Save as PDF... (no quotes, and type the ellipses by hitting option-semicolon) -- and it worked! I made the shortcut Command-Option-Control-P. So now to save a web page as a PDF, I can type Command-P and then Command-Option-Control-P to bring up the Save box to save the PDF. No more having to use the mouse/trackpad to select this.

[robg adds: This works in both 10.5 for sure, and almost but not quite in 10.4 -- you can see the shortcuts in the menu, but they only work if you first activate the menu -- at least, I think that's what's happening. If you have it working in 10.4, please comment. This is an amazingly useful tip, as you can do this for any of the entries in that menu -- I set Control-Command-M to Mail PDF, for instance. I set the shortcuts up for All Applications, since those menu choices are the same in every app, and now I can print and mail PDFs without touching the mouse.]
  Post a comment  •  Comments (18)  
  • Currently 3.10 / 5
  You rated: 5 / 5 (10 votes cast)
[28,965 views]  View Printable Version
Be aware of the 10.4 to 10.5 hardware cut date System
This isn't exactly a hint, but just a heads up. I'm buying some new MacBook Pros online, but I didn't want them to have Leopard installed. I called the Apple Sales line to find out what the situation was.

The Rep said that any machines that ship before November third will have Tiger installed on them (with Leopard in the box). After that, all machines will have 10.5 preinstalled. So if you want a new Mac with Tiger, order right now!
  Post a comment  •  Comments (3)  
  • Currently 3.33 / 5
  You rated: 4 / 5 (3 votes cast)
[10,795 views]  View Printable Version
An AppleScript to move all windows to the main display System
The following AppleScript will move all windows which are offscreen to the main screen. This is useful when you have disconnected an external display, and the windows you had open on that screen (or screens) are now unreachable.

Copy and paste this code into Script Editor:

-- Example list of processes to ignore: {"xGestures"} or {"xGestures", "OtherApp", ...}
property processesToIgnore : {}

-- Get the size of the Display(s), only useful if there is one display
-- otherwise it will grab the total size of both displays
tell application "Finder"
  set _b to bounds of window of desktop
  set screen_width to item 3 of _b
  set screen_height to item 4 of _b
end tell

tell application "System Events"
  set allProcesses to application processes
  set _results to ""
  repeat with i from 1 to count allProcesses
    set doIt to 1
    repeat with z from 1 to count processesToIgnore
      if process i = process (item z of processesToIgnore) then
        set doIt to 0
      end if
    end repeat
    if doIt = 1 then
      tell process i
        repeat with x from 1 to (count windows)
          set winPos to position of window x
          set _x to item 1 of winPos
          set _y to item 2 of winPos
          if (_x < 0 or _y < 0 or _x > screen_width or _y > screen_height) then
            set position of window x to {0, 22}
          end if
        end repeat
      end tell
    end if
  end repeat
end tell

The definitely works in 10.4, and it may also work on OS 10.3. You can find a link to the original source in this blog entry.

[robg adds: You'll need to have the Enable Access for Assistive Devices box checked in Universal Access. The above-linked blog entry contains info on how to exclude certain apps from the script -- for use with programs that hide windows offscreen. Also, if there are updates to the script, they'll be found there, not here. I have not tested this one.]
  Post a comment  •  Comments (8)  
  • Currently 3.31 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (13 votes cast)
[36,742 views]  View Printable Version
Deleting large files System
You may have problems deleting large files. In my case, with OS X 10.3.9, I could not delete a 2.49 GB database file created by Entourage. It would cause a kernel crash, which can be very disheartening.

The problem may be journaling, that useful file system tool that keeps your data relatively safe from major corruption. It turns out that it cannot handle large files. Turn journaling off temporarily by opening Disk Utility (normally in the Utilities sub-folder of the Applications folder). Select the partition on which the large file has been "trashed." Then, under File select the Disable Journaling item, or just type Command-J to disable it. If there is an Enable Journaling option under File instead of Disable Journaling, then journaling is not your problem, and this hint won't help.

Return to the Finder and try emptying the Trash again. You can re-enable journaling by returning to Disk Utility, and selecting Enable Journaling under the File menu again, or by typing Command-J.

I do not not know whether there is some inherent limit to the file size, or whether the problem is that journaling needs enough free disk space to copy the file. In my case there was roughly 2.7 GB of free space available, more than the 2.49 GB file size, but not by much.
  Post a comment  •  Comments (15)  
  • Currently 2.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
[21,033 views]  View Printable Version
Paste and Match Style System
If you use an editor which does not have a "Paste and Match style" option, and you want to copy/paste a fragment of web page or other rich text without all the formatting, use the following script:

pbpaste | pbcopy<br>
Save the script as, for example,
(as hinted here), change the permissions with
chmod a+x poortextformat.command
and that's it. This hint is useful for example in Google Docs, as there is no option to paste plain text.
  Post a comment  •  Comments (7)  
  • Currently 3.75 / 5
  You rated: 4 / 5 (4 votes cast)
[8,523 views]  View Printable Version
FileVault Lite System
Several people want to use FileVault-type protection on less than their entire home folder. I do this to use the same type of protection but for a single folder.

1. Using Disk Utility (in Applications > Utilities), create a sparse disk image using AES-128 encryption. I made mine the size of a DVD so it would never become too large to back-up to a DVD. Also, I saved mine at the top level in my home directory.

2. When creating the password, be sure to leave "Remember Password" checked, so that your keychain can open your disk.

3. Go to the Accounts preference pane (in Applications > System Preferences), and under Login Items, click + to add a login item.

4. Navigate to your 'xxxx.sparseimage' file and add it to the login items list. Now it will auto-mount every time you login.

The only down-side to this hint that I can come up with is that the user must be proactive about where he or she places files. Also, if you place a file in the wrong space, be sure to use 'Secure Empty Trash' to dispose of the non-encrypted version.

[kirkmc adds: There have been several hints about FileVault and other ways to achieve the same functionality, including this hint. It is obvious that if you just want a single folder, or disk image, it's simple to create it from Disk Utility. (In fact, I wrote it up back in 2004 for Macworld.) It's useful to know about this, though, whether you want to use it for many files, or simply to lock down a selection of files.]
  Post a comment  •  Comments (10)  
  • Currently 2.25 / 5
  You rated: 4 / 5 (4 votes cast)
[14,586 views]  View Printable Version
Growl - An event notification system System
The macosxhints Rating:

[Score: 9 out of 10]
Growl is a system-wide notification system -- it sits there silently in the background, watching any number of things, waiting for an event to occur. When an event occurs, Growl then notifies you via a customizable pop-up window, which appears and then vanishes after a set amount of time. And just what is an event? An event is something that a supported application tells Growl about. For instance, in Transmit, when an upload complete, Transmit will inform Growl of that fact, and Growl will then show an "upload complete" window. There are a large number of programs that include native Growl support; in addition to Transmit, the list includes Skype, Adium, Colloquy, and many others. Other programs, such as Camino, Firefox, and Safari can have Growl support added by way of their own Growl notifiers.

So why would you want to be notified about events? I'll give you a couple examples of how I use Growl. I use the GrowlMail extra (in the Extras folder on the Growl disk image) to pop up a small message showing the sender, account, and subject of the message when I receive a new email in Mail, as see in the image at left. If I click in the window, that message will open in Mail.

I use GrowlCamino in place of Camino's built-in Downloads window (there's a similar Growl add-on available for Firefox, and a Safari add-on is included in the Growl distribution). When a download starts, a window pops up to let me know. When the download completes, another window appears -- and with a simple click in that window, the downloaded file will be opened (i.e. the disk image will mount). The add-on will also notify Growl if Camino blocks a pop-up window.
read more (187 words)   Post a comment  •  Comments (11)  
  • Currently 2.20 / 5
  You rated: 3 / 5 (10 votes cast)
[31,471 views]  View Printable Version
Prevent the creation of profiles.bin in the home folder System
I was looking to solve the mysterious auto-creation of a file creation of profiles.bin in my Home folder. I found this hint useful for deleting the file with AppleScript. In that hint, the author attributes the file to non-English versions of Microsoft office. I did a bit of poking around and was able to find another solution and information about the source on this post on the forums.

The page is in Italian, but for those of you who can't read it, clever user 'faxus' explains that Microsoft Office is most likely only part of the problem. He continues to explain that there is problem with the Display profiles being out of sync with certain applications, and profiles.bin is therfore created by necessity upon restart. User 'marcodal' notes then that creating a new Display profile on the affected machine solves the problem.

Therefore, following his example, I went to System Preferences » Displays » Color » Calibrate, and accepted all of the default settings for my MacBook Pro 2.4; this created a new Display profile called "Color LCD Calibrated." After a few restarts and running of different Office programs, I do not see the profiles.bin file being created any more.

I can't say if this is useful only for the Italian version of Office. Obviously Italians are having the issue, but my own version of Office is English language.
  Post a comment  •  Comments (2)  
  • Currently 3.50 / 5
  You rated: 5 / 5 (6 votes cast)
[15,896 views]  View Printable Version
An AppleScript to sync creation and modification dates System
This previous hint showed how to set up an AppleScript droplet to modify the creation date of a file. But what if you want to sync the modified date and Creation dates instead? This AppleScript has been created to do just that. It has evolved from one Daniel A. Shockley provided in a comment to the previous hint, and has been extended to fit this purpose.

To set your files' modified date to be the same as the creation date, use the AppleScript as a droplet application. Copy and paste the text into a new script in Script Editor, and then save it as an application. Run the application to bring up a requester, or drop your files (not folders) on the application directly.

[robg adds: I haven't tested this one.]
  Post a comment  •  Comments (6)  
  • Currently 1.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (1 vote cast)
[9,078 views]  View Printable Version
Allow non-admin users to run Software Update System
Software Update has a 'quirk' in which non-admin users will never get prompted to install updates, even if the administrator sets them automatically download. So the problem is that if you have multiple machines in a mostly unmanaged environment, updates only occur if an admin logs in or if users run Software Update manually, and in either case the process must be authenticated with an admin password

But partially no more! If you edit the sudoers file, you can allow the CLI version of Software Update (i.e. softwareupdate) to be executed by your users.
  1. Edit the sudoers file /etc/sudoers. Use the command sudo visudo; this will drop you into the default visual editor (usually vim).
  2. Add ALL ALL= NOPASSWD: /usr/sbin/softwareupdate to the file. Placing it at the bottom is OK. Be sure to add comments on your change by using # as the first character. Do not comment out the actual sudoers directive you just added, however. Save and exit the editor.
  3. Run softwareupdate -ia from Terminal in a non-admin user (any) account and watch the show.
I don't think this action will prompt for a restart, so the system will be running in an indeterminate state. Be sure to restart right away if you are trying this on a reboot-needed update. You have been warned.

Real world uses
With this hurdle covered, you can now add a cron/launchd job to download updates for sure (softwareupdate -d). I have been thinking about seeing if I can work this into the logouthook function. If so, then shutdown -r now will also need to be in sudoers. It has also been suggested to use an osascript command to issue a Finder restart to allow users the normal warnings.
  Post a comment  •  Comments (13)  
  • Currently 2.83 / 5
  You rated: 5 / 5 (6 votes cast)
[22,438 views]  View Printable Version