Archive for the 'launchy' Category

Create a new email in MS Outlook with Launchy

Wednesday, September 26th, 2007

I realized recently that I was never looking at my Outlook application when I wanted to start a new email to someone, and I had no quick-and-easy way to launch a new email message. So after a quick search Google search, I found this site with instructions on how to do many things in Outlook from the command line. And it was super easy to whip up a quick batch script that could do exactly what I wanted, then put it in my ‘bin’ directory where I keep all my other Launchy scripts (as described in this post).

newMail.bat
“c:\Program Files\Microsoft Office\Office10\Outlook.exe” /c ipm.note

Now to pop up a new Outlook email message, it’s as easy as typing “Alt-Space newmail”.

Finding new uses for Launchy is wonderful.


Using Launchy and batch shortcuts for navigation

Tuesday, June 12th, 2007

I don’t like Windows links (.lnk). They are useful to create shortcuts to other places in the filesystem, but they lack meat. You can’t do much else with them. And the way I use them with Launchy, all I want to do is put them somewhere that Launchy can find them and give them a catchy name I’ll remember so I can just ‘Alt-Space’ and type the link name to rocket to a place in my filesystem.

I have found a better way to use batch files with Launchy, and here is a tutorial on how you can do it, too.

The Scenario

fs_launchy_batch.jpg

Here is a scenario to better illustrate this example. I have a java project with source folders that I need to navigate to quickly. There is one trunk, and possible branches that I want to have at my fingertips. I not only want to be able to pop up a windows explorer at these locations, but I also need to be able to open a command line so I can run ant tasks. Here is the location of the application (called ‘myApp’) source code. One is a trunk and one is a release branch.

The Environment

Since I’m going to be working on this application for a long time, I might as well set up some environment variables to make the whole process easier. That way if I ever decide to move the location of myApp, I can just change it in one place on the OS and be happy. To quickly open up the ‘System Properties’ window, press the Windows Key (icon here) and ‘Break’ simultaneously (or Right-Click on ‘My Computer’ and choose ‘Properties’). From here, click the ‘Advanced’ tab, then the ‘Environment Variables’ button.

I created three environment variables:

Name Value
MYAPP C:\dev\java\myApp
MYAPP_TRUNK %MYAPP%\trunk
MYAPP_RELEASE %MYAPP%\branch

The “%MYAPP%” is Windows’ way of using an existing environment variable within another’s definition. This way if I move ‘myApp’ into another location on the filesystem, I just have to change the MYAPP variable and the MYAPP_TRUNK and MYAPP_RELEASE are relative to that parent.

env_launchy_batch.jpg

You can see from the above window that Windows translated the %MYAPP% variable into its value (you may have to close the ‘System Properties’ dialog and reopen it to see the change). Now lets move on to the batch files that will use these variables.

The Batch Files

So I want to be able to reach the following directories, both from the exploerer window and the command line:

  • C:\dev\java\myApp
  • C:\dev\java\myApp\trunk
  • C:\dev\java\myApp\branch

You’ll need to decide where you want to put your batch files so Launchy can find them. Anywhere is fine, just remember where you put them. Because of old habit, I put all my batch files under home\bin. You can name these batch scripts whatever you like, but it should be something you can remember. You’ll be typing the names of these batch files into Launchy to navigate to these folders.

First, let’s create a batch file that will open up a command line on the “C:\dev\java\myApp” folder (remember that the MYAPP environment variable stores this value). I’m going to call this batch file “myApp.bat”.

myApp.bat
cd %MYAPP%
cmd

Simple enough? The first line changes directory into the MYAPP folder. The second line opens a command line prompt at that location.

I’ll do the same thing for the other locations that I want easy command line access to, using the other environment variables as the paths:

trunk.bat
cd %MYAPP_TRUNK%
cmd
release.bat
cd %MYAPP_RELEASE%
cmd

Now for the batch files that will open up explorers in these same locations. First for the ‘MYAPP’ location:

myAppex.bat
explorer /e,%MYAPP%

The first (and only) line opens an explorer window at the location specified in the MYAPP variable, in the default manner. The “/e” is an parameter on the explorer command that tells it to open in its default view (for more explorer options, see here).

Now to create the other explorer shortcuts:

trunkex.bat
explorer /e,%MYAPP_TRUNK%
relex.bat
explorer /e,%MYAPP_RELEASE%

Now we are ready to tell Launchy where these shortcut batch files are located.

Launchy

dirs_launchy_batch.jpg

In order to get Launchy to be able to see and execute these batch files, we need to add them to its indexed directories. This is fairly simple to do. Open up Launchy by pressing ‘Alt-Space’, then right-click and choose ‘Directories’. Click the ‘Add’ button and choose the directory where you stored your batch files. Now select that directory from the left list, enter ‘.bat’ in the circled field below, and click the ‘Add’ button below the field. This tells Launchy that you want it to index all *.bat files in that directory.

Now open Launchy again, right-click on it and tell it to ‘Rebuid Index’. Now you should be able to ‘Alt-Space’ and type ‘myApp’ to open a command line to the MYAPP directory. And if you type ‘myAppex’, Lauchy will execute the myAppex.bat file and open an explorer window to tha myApp directory.

Doing this for all the file locations you spend a lot of time to will greatly decrease the time you spend manually navigating places, or even searching for the closest shortcut.


Using Launchy for application launching

Saturday, April 14th, 2007

I work with someone from OCI who has noted that there are a finite number of keystrokes within his fingers, so every one needs to count. This leads us geeky developer-types to take advantage of shortcuts within our IDEs and frequently-used programs. I have found an application that extends this mindset seamlessly into the Windows OS. It has made my use of Windows extremely fast. In fact, while pair programming or demonstrating something, more than one other programmer has seen me use this tool and asked something along the lines of “What was that thing you just used to open [some program] so quickly?”.

So I’ll tell you.

Launchy is probably the most useful free Windows productivity application I’ve ever downloaded. I use it all the time, sometimes hundreds of times a day. From the Launchy website:

Launchy is a free windows utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager.

Launchy indexes the programs in your start menu and can launch your documents, project files, folders, and bookmarks with just a few keystrokes!

For my first example, compare the following methods of opening Firefox, assuming your hands are where they should be… on the keyboard:

Without Launchy
  1. Remove right hand from keyboard.
  2. Move mouse cursor to either:
    • Firefox desktop shortcut
    • Firefox quicklaunch icon
    • Start –> All Programs –> Mozilla –> Firefox
  3. Click mouse button.
With Launchy
  1. Type: Alt+Space, fire, Enter

Bookmarks

Even better, Launchy indexes all my bookmarks so I can just type “Alt+Space, danlog, Enter” to bring up my weblog. Launchy keeps track of your most recently used applications and tries to guess which one you mean when you type “danlog“.

Media

You can also tell Launchy which directories it needs to index, and what types of files to index. So you can put all your MP3’s in your music directory at your fingertips. Want to listen to Beercan by Beck, just type “Atl+Space, beercan, Enter“, and it pops up in your default MP3 player.

Navigation

Also use Launchy to navigate to the most-used locations in your file directory. I have a folder that Launchy keeps indexed where a bunch of shortcuts exists (Windows .lnk files). So if I want to go to my Eclipse workspace, there is a workspace.lnk within that folder, so I can just type “Alt+Space, work, Enter” to bring the folder up.

Scripts

Some of the most useful things I’ve done with Launchy include custom batch programming. There are some Ant tasks for projects I’m working on that I tend to run all the time, so I have written some very simple batch scripts and placed them into Launchy’s index. Now I can just type “Alt+Space, report, Enter” to open up a command window, navigate to my project folder, and run “ant report” from the command line.

Anything!

You can put any folder into Launchy’s index and have it look and attempt to execute any file type. It will open data or media files with the default program if one is specified. I’ve even put my Windows “recent” link within the index so I can bring up all my recent files with a few keystrokes.

If you are concerned about how many keystrokes you have left in your fingers, I urge you to check out Launchy.

Links