Important: This document may not represent best practices for current development. Links to downloads and other resources may no longer be valid.
Version 1.0, 2006-02-23
iTunesController allows you to control iTunes without having to bring it to the foreground.
Xcode 2.2, Universal Binary
Mac OS X 10.4
iTunesController makes use of the RegisterEventHotKey API which allows you to register to receive hotkey events while in the foreground or background. Registering for a hotkey such as <command>-P causes problems because, once registered for a hotkey, that event does NOT get propagated to the frontmost application, and in this case, would intercept it from printing. We overcome this problem, in the routine PostHotKeyKeyboardEvent, by first unregestering for hotkeys, posting the event to the frontmost application using CGPostKeyboardEvent, and then re-registering for hotkeys. This sample also demonstrates how to communicate with iTunes through an AppleScript in our timer routine, PeriodicTimerAction. Builds as a Universal Binary
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-02-23)