For example, I named my script shell.scpt, and so to set it in motion I type (or start to type) shell from within LaunchBar, and then hit the space bar (so that I can enter the command) when I see that shell is the highlighted action. You can name the script whatever you want, but keep in mind that this name will be the alias used to launch it from within LaunchBar. Terminate the last session of the first terminal Tell the last session of the first terminal to write text command Tell the first terminal to launch session Default ~/Library/Application Support/LaunchBar/Actions/. To get the script working, simply paste the below code into a new file from within Script Editor, and save the file to: The iTerm-centric script opens a new session (i.e., a new tab) within the first open terminal window (I’m assuming most people use a single window with multiple tabs) so as not to disrupt whatever you currently may be doing within iTerm, executes the shell command you gave LaunchBar, closes the session/tab and returns the window focus to whatever application you were using before you invoked LaunchBar. (Obviously with a few simple tweaks you can have the script check to see if iTerm is open, and then either activate or launch, depending.) The script assumes iTerm is running in my case, if the computer is on, iTerm is open. The first relies on iTerm, which, for the past few years has been my Mac OS X terminal emulator of choice, and, as luck would have it, is AppleScript-able. To this end I coded up two separate AppleScripts, each of which solves the problem in a slightly different way. Instead of bringing a terminal emulator into focus and then executing the command, I thought it would be more efficient (and the sequence more easily assignable to muscle-memory) to use LaunchBar to run the command. The only solution I’ve found is to execute killall Dock from a terminal (thanks Richard), which kind of resets everything. About 75% of the time, certain elements of the OS don’t appreciate that the screen resolution has changed (i.e., that the working resolution is now much lower), and so things like Expose and Spaces - which I’ve mapped to corners of the screen - can’t be triggered. In any event, I came up with these AppleScripts in order to solve an annoying problem that presents itself at the end of the following sequence: 1) plug closed MacBook Pro into a 24 Apple LED Cinema Display and use only that monitor 2) disconnect the display from the computer and sleep the computer and 3) wake the computer and use only its built-in display. (There was nothing wrong per se with Quicksilver, but core development kind of stopped ( it was open-sourced) when the software’s creator headed to Google to run its Quick Search Box for Mac project, and even he was recommending that users jump ship and try LaunchBar.) It’s just great software, if a tad bit expensive (~$35). These days I use LaunchBar for just about everything, even to a greater extent than I did with Quicksilver (and I was a Quicksilver nut). Early this year I migrated from Quicksilver to LaunchBar and haven’t looked back.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |