This hint updates this hint which provides an AppleScript that changes the sound input or sound output device selection.
I use Control Plane to manage various preference differences among the different locations (work, home, travel) where I use my MacBook. Control Plane uses various criteria (e.g., IP address, WiFi network name, etc.) to determine your location. Control Plane offers a lot of built in capability to change settings on your Mac based on arriving or leaving a location, and I recommend it highly if you regularly move your Mac among different working environments.
One capability that is not available in Control Plane is the ability to change Sound preferences when you move your Mac from one place to another. In my case, I have a Thunderbolt Display at work, which has built-in speakers and a built-in microphone. At home, I use my MacBook without a second display. I wanted to be able to change the Sound preferences back and forth using Control Plane.
Control Plane does offer the capability, however, to run any application when it detects that have arrived at or have left a particular location. So, you can run any AppleScript.
Relying on the hint comments here, I have updated the scripts in that hint to address my desire for changing sound preferences. My updated script should work on Lion and Mountain Lion. I cannot say whether it will work on earlier versions of OS X.
tell application "System Preferences" to activate
tell application "System Preferences"
reveal anchor "input" of pane id "com.apple.preference.sound"
end tell
tell application "System Events" to tell process "System Preferences"
tell table 1 of scroll area 1 of tab group 1 of window 1
select (row 1 where value of text field 1 is "Internal microphone")
end tell
end tell
quit application "System Preferences"
Note that this script hard codes the name of the Sound preferences pane tab to select and the sound input device to select. To set an output device, you would change "input" to "output" in the 3rd line of the script and then change the device name in the 7th line. I created separate scripts for sound input and sound output for each location where I work. I then simply created a Control Plane rule for each location for sound input and sound output separately.
Placing a comma after a phone number in Contacts allows you to add useful information. Without the comma, any information after the number will prevent it from auto-dialing on the iPhone, not recognizing it as a phone number.
Before smart phones I often found it useful to add additional information after a phone number in a contacts database, such as an extension number (x123), person's name or initial (John or J), function (billing), etc. The template in Contacts does not have a field for Extension which would allow for this. In addition, with the iPhone, the number itself will not even assume the proper format (area code in brackets, 3 numbers, dash, 4 numbers) if there is any additional information after the number, and therefore you won't be able to dial the number.
Putting a comma after any phone number (read as a one-second pause, as with modems) allows for any such qualifying information to be added. For me this is much easier than creating hundreds of custom fields for phone numbers.
Microsoft Word 2011 does not, as far as I can tell, offer a means of assigning a keyboard shortcut to close the sidebar. The AppleScript described here provides that functionality, and sets a keyboard shortcut that will trigger it.
Name the following Applescript "MicrosoftWordCloseSidebar\mosH.scpt" (notice the reversed slash) and save it in ~/Library/Application Support/Microsoft/Office/Word Script Menu Items:
do shell script "osascript -e '
tell application \"System Events\" to tell process \"Microsoft Word\"
set {frontmost, itemFound} to {true, false}
repeat with w in windows
tell w to repeat with g in groups
tell g to repeat with c in checkboxes
tell c to if value of its attribute \"AXHelp\" = \"Close the Sidebar\" then
set itemFound to true
click
exit repeat
end if
end repeat
if itemFound then exit repeat
end repeat
if itemFound then exit repeat
end repeat
end tell
' >/dev/null 2>&1 &"
When you press Command-Option-Shift-H, the close button of the sidebar is clicked, and the sidebar closes. The keyboard shortcut comes from the "mosH" part of the Applescript name (m=Command, o=Option, s=Shift, H=the letter H). That shortcut was chosen to complement the existing shortcut to open the Find/Replace Sidebar (Command-Shift-H) and may be altered to suit a particular user's needs. The script is constructed as a background osascript to get around a problem that occurs when trying to GUI-script Microsoft Word from its script menu.
Mail, by default, provides a preview of attachments in can read, such as graphics and PDF files. However, you can run a command in Terminal to turn this off. Run the following:
Quit Mail and relaunch it. When you view a message, all attachments will be shown as icons only. To restore the original functionality, run this command:
defaults write com.apple.mail DisableInlineAttachmentViewing -bool no
iPhoto 11 added an awful new built-in email service that replaces the previous functionality: when sending an email, it used to open Mail and attach the photos to a new email. Now, it uses a poorly designed, built-in email functionality that ruins everything.
To send photos again using Mail, run the following command in Terminal:
defaults write com.apple.iPhoto EmailApp Mail
To return this functionality to iPhoto, run the following command in Terminal:
I find frustrating the way Numbers prints large tables – they're often split both horizontally and vertically across multiple pages.
One way to print a large table on a single page is to copy the table and open it in Preview. In Numbers, click the dragging square at the top left of the table. (You need to scroll to the top of the table to see it.) Press Command-C, open Preview and press Command-N. Print away.
[kirkmc adds: Interesting: if you paste a table into Preview, it's displayed with no borders or extra space, as if it were a PDF. (There's a hint explaining this.) However, when you print, make sure to select Scale to Fit, then Fill Entire Paper. I tried pasting a long table - about 300 lines - and Preview, using the default print settings, would have printed the entire table on one page.]
I spotted something today in iTunes 11, which I don't recall seeing before. If you right-click on a Genius Mix icon, you can choose Remove > Genius Mix name> and delete it from the Genius Mixes list. If you want to get all your Genius Mixes back, you can right-click anywhere in the white space of that window and choose Restore All Mixes to get them all back. But you still have no control over how Genius Mixes are created.
User Aphex5 posted an interesting question on Stack Exchange, asking if there was a way to create playlists for all complete albums in his iTunes library. He then followed up with an answer, the following AppleScript:
-- Creates a playlist for each full album you have in iTunes
-- Set the playlistPrefix and playlistSuffix as desired before running
-- Based on code by Brad Campbell
-- http://www.bradcampbell.com/2009/05/26/make-a-whole-album-playlist-in-itunes/
tell application "iTunes"
set playlistPrefix to "FA: "
set playlistSuffix to ""
-- The "FA: " prefix will help cluster full albums in iTunes' playlists,
-- and is narrow enough to not get in your way when viewing on an iPhone
set albumBuckets to {} as list
set allSongs to (every track of library playlist 1 whose enabled is true and podcast is false and kind contains "audio") as list
-- Find all partial albums in iTunes
repeat with currentTrack in allSongs
set albumName to album of currentTrack as text
set artistName to artist of currentTrack as text
-- First check for missing values, then perform integer comparison
-- Zero is on the left to force interger type coercion, just in case
if album of currentTrack is not missing value and 0 is less than length of albumName then
if artist of currentTrack is not missing value and 0 is less than length of artistName then
if track number of currentTrack is not missing value and 0 is less than track number of currentTrack then
if track count of currentTrack is not missing value and 0 is less than track count of currentTrack then
if albumBuckets does not contain album of currentTrack then
copy album of currentTrack to the end of albumBuckets
end if
end if
end if
end if
end if
end repeat
repeat with currentAlbum in albumBuckets
set albumSongs to (every track of library playlist 1 whose album is currentAlbum)
set firstTrack to first item of albumSongs
-- Filter album list to act only on full albums
if (count of albumSongs) is equal to track count of first item of albumSongs and 1 is less than (count of albumSongs) then
-- This is a full album, construct the playlist
-- Sort tracks by track number
set albumSongsSorted to {} as list
repeat with i from 1 to (count of albumSongs)
repeat with trk in albumSongs
if track number of trk is i then
set nextSong to trk
copy nextSong to the end of albumSongsSorted
end if
end repeat
end repeat
-- Don't show artist name for compilations
if firstTrack is not compilation then
set playlistNameArtist to artist of firstTrack & " - "
else
set playlistNameArtist to ""
end if
set albumPlaylistName to playlistPrefix & playlistNameArtist & currentAlbum & playlistSuffix
-- Create playlist
if user playlist albumPlaylistName exists then
try
delete tracks of user playlist albumPlaylistName
end try
else
make new user playlist with properties {name:albumPlaylistName}
end if
try
repeat with trk in albumSongsSorted
duplicate trk to user playlist albumPlaylistName
end repeat
end try
end if
end repeat
display dialog "Playlists created! Check iTunes for playlists beginning with '" & playlistPrefix & "'"
end tell
This will traverse the iTunes library and make playlists for every album where the number of tracks matches the total number of tracks for the album; in other words, if you only have one or six songs from a ten-song album, it won't make a playlist. Naturally, this assumes that you have the correct metadata for your tracks to enable this. If you don't, you can go through your albums - one by one, alas - using Doug Adams' Albumize Selection AppleScript; this script sets both track number and track count tags to the appropriate numbers.
I'm affected by a mild form of phonemic deafness: the part of my brain in charge of translating sound into words doesn't work perfectly. Therefore, understanding spoken language is more difficult for me than for the average human, even in my mother tongue (Italian). Nevertheless, I've been always fascinated by languages, and I have learned to read in a few of them.
With the advent of the DVD, movies and TV series in their original language have become available and I'm using them as a mean to improve my comprehension. Usually, I try to understand the dialogues without using subtitles, but sometimes I need to look at them (if possible, in the language of the audio track) for a while. Apple's DVD Player allows me to do so, but you need to issue a series of commands using the controller or the menus to turn them on. However, it is possible to automate this process, causing the video to scrub backwards a little, activate the chosen subtitles and start the playback again.
As a first step, you must create a new service in Automator with a single action: "Run Applescript" (located in "Utilities"). Input the following script:
tell application "DVD Player"
rewind dvd
delay 1 -- approximate rewind time in seconds
pause dvd
set subtitle to 1 -- to choose first item of available subtitles
play dvd
end tell
Select the options "Service receives no input" and "in any application".
The number after "delay" controls the amount of back-scrubbing; you may try different values to fit your taste, and "set subtitle to 1" enables the first set of available subtitles.
Save the service with an appropriate name and open the Keyboard Shortcuts tab of System Preference's Keyboard pane. Select "Services" in the leftmost section and add a keyboard shortcut that suits you for the newly created service.
You may duplicate the process above, changing "set subtitle to 1" with "set subtitle to 2", etc. to create commands that select other sets of subtitles.
As a last step, create a service with the following AppleScript:
tell application "DVD Player"
set subtitle to 0
end tell
You may have seen the news: the latest update to the Apple TV (2nd generation or later) allows you to use a Bluetooth keyboard. This makes searching for things much easier; the non-keyboard interface is slow and clunky. If you want to use a Bluetooth keyboard with your Apple TV, you can see this Apple technical document which explains how to set up a Bluetooth keyboard with an Apple TV, how to disconnect the keyboard, and how to troubleshoot common problems.