Work Faster in Windows With Launchy and a few Python Scripts

3 min read · Posted on: Dec 4, 2007 · Print this page

Eating the Mouse

Launchy is a great productivity tool and a cool way to impress your friends. You can launch any application by pressing a hotkey (say Alt+Space) and the first few letters of the application for eg: typing ‘gi’ will display the GIMP icon and pressing Enter will launch GIMP. You can download Launchy from its website and its beta is pretty stable (and gorgeous) on my XP laptop too.

Using Launchy gets pretty addictive and soon you will hate using the Start menu or even Explorer on Windows for opening applications or files. So I took the red pill and started automating the following things with a little help from Python:

  • Launching Intranet applications inside Internet Explorer (even if Firefox is your default browser)
  • Bringing minimized or overlapped windows to the foreground

Some Necessary Evil

Don’t get me wrong, I hate IE as much as you do. But the fact of life is that many web apps out there “Work best when viewed in IE” (TM). Even if you have launchy plugins to launch the web app, if your default browser is Firefox, it might show incorrectly. Here is the solution:

  1. Install Python and Pywin32
  2. Copy the following script to the Utilities directory (it will be in the path where you installed Launchy) and save it with a .pyw extension not a .py extension


from win32com.client import Dispatch
ie = Dispatch("InternetExplorer.Application")
ie.Visible = True

In the above code replace the URL http://intranetapp/home with the URL of your choice.

Finally, open Launchy, right-click and say ‘Rebuild Index’.

No more Alt-Tabbing around

If you are like me, you’ll have a lot of windows open at the same time. I have tried increasing the task bar height and grouping similar windows feature in XP to manage them. But I always wish I could invoke commonly used open applications like my chat window in just a few keystrokes. Launchy doesn’t index open programs by default, but with some python magic I can show you how to bring some commonly used windows to the foreground:

  1. As before, install Python and Pywin32
  2. Copy the following script to the Utilities directory (it will be in the path where you installed Launchy) and save it with a .pyw extension not a .py extension


import sys
from win32gui import GetWindowText, EnumWindows, ShowWindow, SetForegroundWindow
from win32con import SW_RESTORE, SW_SHOW

TITLE_MATCH = "Microsoft Excel - Expenses.xls"

def listWindowsHandles():
    res = []
    def callback(hwnd, arg):
    EnumWindows(callback, 0)
    return res

def listWindowsNamesAndHnd():
    return [(hwnd, GetWindowText(hwnd)) for hwnd in listWindowsHandles()]

def unminimizeWindow(a_hwnd):
    ShowWindow(a_hwnd, SW_RESTORE)

def finder1():
    for hwnd, title in listWindowsNamesAndHnd():
        if TITLE_MATCH in title:


In the above code change the string Microsoft Excel - Expenses.xls with the title the window you would like to summon.

Finally, open Launchy, right-click and say ‘Rebuild Index’.

This works even if the window was minimized.

I hope, finally you can throw your mouse away. Ah… What a bliss!

Arun Ravindran profile pic

Arun Ravindran

Arun is the author of "Django Design Patterns and Best Practices". Works as a Product Manager at Google. Avid open source enthusiast. Keen on Python. Loves to help people learn technology. Find out more about Arun on the about page.

Don't miss any future posts!

Comments →

Next: ▶   Happy Organised 2008

Prev: ◀   Best Software Doesn't Have To Be The Hardest To Make

Up: ▲   Blog

Featured Posts

Frequent Tags

banner ad for Django book


powered by Disqus