I knew that there had to be a simple way to get global hotkeys without having to pay for software. Granted, Quicksilver can do global hotkeys, but I don't use it anymore because it seems to have issues with crashing, memory leaks, and the new spotlight does a decent enough job for me. Anyway, this link http://www.monkeybreadsoftware.de/Freeware/GlobalHotkey.shtml has a simple program with some examples as to how it runs.
The program runs hidden, you wouldn't notice it unless you open up your activity monitor. Which also means that it doesn't install itself, so if you want it to run all the time, you'd be best to add it to your login items group. It took me a little while to figure out what it did and didn't like though. It was finicky about my file format, you can't save an applescript and have it run it. It is capable of running applescripts, shell scripts, and applications, but to do so you have to follow some rules.
Now, you might ask why you would want an application that still requires you to manually assemble the code? Well, if you want it all done for you, then you'd better buy a program because I only wanted this for simple features. I wanted a global hotkey to advance through my iTunes playlist without having to bring iTunes up front. I might also want a global hotkey to launch a specific application, or to refresh my Dock, SystemUiServer, or Finder. A standard program that allows you to assign hotkeys usually doesn't allow for shell scripting. All you need to know is what command you want to run, whether it's applescript, shell scripts, or an application, and you create a simple text file with the command. Of course, test your applescripts with script editor first, make sure they work, then copy it into a new text document. But, there is a trick here and I will try to make it simple.
First, open TextEdit.app. As an example, add this text to a new blank document
tell application "iTunes" to play
Now, save the document under the name of a keystroke (one that isn't used by system services or any other application menus, I've chosen F5). Notice in my screenshot that I have chosen not to include the extension and that I've selected a Unicode type text file format. If the file name includes any extension or is otherwise not a series of keystrokes such as; command option j, option 4, etc., then the command will not work. Also, it should be saved in the folders that came with the application. I saved the contents of the opened .dmg file in a folder called Global Hotkey. Ensure that this file is being saved in the Global Hotkey/Applescripts folder. Double click the app, Global Hotkey.app, use F5 to play iTunes. I actually put in playpause and F4. I created two more scripts just like this and assigned back track to F3, playpause to F4, and next track to F5. Now, as long as the app is running I will always maintain control of my iTunes no matter what application I'm actually working in.
Similarly, all you have to do to launch an application is create an alias, drag it to Global Hotkey/Applications and rename it to another valid keystroke. Personally, I don't have much need for this as I'm satisfied with using Spotlight, but maybe you want to launch something that is in a folder or on a drive that spotlight is not monitoring, then there you go.
Apple Feedback
No comments:
Post a Comment