On this page:

AutoHotkey scripts for switching to windows

Muscle memory helps you be more efficient. Here’s some AutoHotkey code I use to toggle Chrome (F10), Windows Live Writer (F11), or my Freemind mindmap for Life (F12). Make your own! =)

F10::
WinGetActiveTitle, Title
If Instr(Title, "Google Chrome") > 0
{
   WinMinimize, A
}
Else If WinExist("ahk_class Chrome_WindowImpl_0")
{
   WinActivate
   WinMaximize
}
Else 
{
   Run, "C:\Documents and Settings\Administrator\Local Settings\Application 

Data\Google\Chrome\Application\chrome.exe"
}
return
F11::
WinGetActiveTitle, Title
If Instr(Title, "Windows Live Writer") > 0
{
   WinMinimize, A
}
Else If WinExist("ahk_class WindowsForms10.Window.8.app.0.33c0d9d")
{
   WinActivate
   WinMaximize
}
Else 
{
   Run, "C:\Program Files\Windows Live\Writer\WindowsLiveWriter.exe"
}
return
F12::
WinGetActiveTitle, Title
If InStr(Title, "Life.mm") > 0
{
   WinMinimize, A
}
Else IfWinExist Life.mm
{
   WinActivate
   WinMaximize
}
Else 
{
   Run, c:\sacha\Life.mm"
}
return

Automation

A repetitive task is an excuse to learn more about automation tools. My text automation tool of choice is Emacs, a ridiculously programmable text editor. When it comes to numbers, I can do a lot with equations, pivot tables / data pilot, and judicious use of macros. For general automation on Windows, there’s AutoHotkey.

My threshold for automation is lower than most people’s. When faced with a repetitive task that will take me an afternoon to do, I’ll spend maybe half an hour understanding the task, an hour figuring out how to do it using the tools, and another half hour to an hour completing it with automation’s help. I spend the extra time learning more about the automation tools or sharing what I’ve done.

Even if the time savings are probably not going to be significant, if the task is sufficiently repetitive, I’ll go for the intellectual thrill of automating it. Bonus: if I have to do the task again (which occasionally happens), I have my process all ready to go.

What would it take for people to learn how to automate more things? How do I do it? How did I pick up this habit?

Part of it is knowing the capabilities of a tool. I know that I can simulate mouse clicks and keypresses, so when I catch myself repeating certain motions, I think about how I can automate that.

Part of it is being able to abstract the steps in a procedure. I can figure out what can be easily automated and what needs manual intervention. If I can automate 80% of something, that’s usually enough.

Part of it is being able to program and not being afraid of geeky interfaces.

Part of it is asking if the time-intensive parts of the procedure are really necessary. (Sometimes they’re not.)

I like automation. I wish more people were comfortable doing it.

Want to get started? The best way is probably to pick a tool depending on what you spend most of your time doing, learning lots about your tool, and doing little experiments. For Emacs, it might be learning how to use keyboard macros, then using Lisp. For Excel, learn different functions (I use CONCATENATE and IF a lot). For AutoHotkey, try using it for abbreviations, then expand.

Have fun and save time!

Braindump: Automating repetitive tasks using AutoHotkey

Note for myself (because I’m going to need this again someday!), and for others who drop by:

I needed to copy information from 45 slides and put them into an Excel spreadsheet so that I could reorganize the content and put them into a wiki. Fortunately, the author of the Powerpoint deck used a fairly consistent slide format. I used AutoHotkey to copy most of the information over by simulating mouse clicks and button presses. I started with this macro, which copies the text, switches to my spreadsheet, moves a cell to the right, and pastes it:

F12::
Send, {CTRLDOWN}c{CTRLUP}
WinWait, Microsoft Excel - facilitation.xls, 
IfWinNotActive, Microsoft Excel - facilitation.xls, , WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}
WinActivate, Microsoft PowerPoint
return

 

I wanted to save even more keystrokes and mouseclicks, so I ended up automating the copying of each slide using the following script. It wasn’t perfect, but it saved me time and it was fun to make.

F11::
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left, 1037,  327, 1500, 327
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {CTRLDOWN}v{CTRLUP}{RIGHT}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left,  1037,  366, 1500, 366
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{CTRLDOWN}v{CTRLUP}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left,  457,  344, 1500, 1000
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{RIGHT}{CTRLDOWN}v{CTRLUP}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left,  454,  454, 1500, 1000
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{CTRLDOWN}v{CTRLUP}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left,  564,  535, 1500, 1000
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{CTRLDOWN}v{CTRLUP}{ALTDOWN}{ALTUP}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
MouseClickDrag, left,  490,  637, 1500, 1000
Sleep, 100
Send, {CTRLDOWN}c{CTRLUP}
WinActivate, Microsoft Excel - facilitation.xls, 
WinWaitActive, Microsoft Excel - facilitation.xls, 
Send, {RIGHT}{CTRLDOWN}v{CTRLUP}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{LEFT}{DOWN}
WinActivate, Microsoft PowerPoint - [ID Methods.ppt], 
WinWaitActive, Microsoft PowerPoint - [ID Methods.ppt], 
Send, {PGDN}
return

Automation is worth the time investment. If you’re on Windows, check out AutoHotkey. =)

Old notes on staffing a virtual conference booth

It’s fantastic how a blog archive lets me pull up lessons learned from a virtual conference I helped at two years ago. Some of these tips from my internal blog post are platform-specific, but others might be useful.

Staffing the Social Networking booth at the Innovation in Action event. Here are quick tips:

  • Set up text shortcuts. You’ll need to type in a lot of text rapidly. The built-in Text Entries are not available when you’re sending an initial message or inviting someone to a chat, so type in some boilerplate text into Notepad and then copy and paste it. Messages you send from the booth will be marked as from your booth name, so include your name and e-mail address in your message. Advanced tip: use AutoHotkey to create a text macro. Install it from AutoHotkeyInstaller.exe, create a file like shortcuts.ahk (customize this of course), then double-click shortcuts.ahk to make it part of your system. Example shortcuts.ahk:
    ::!hello::Welcome to the IBM social networking booth. I’m Sacha Chua ([email removed]), a consultant who helps organizations figure out what Web 2.0 is, how it fits with their strategy, how to implement it, and how to make the most of it. Please feel free to ask me questions by sending a note or inviting me to chat. What can I help you with?
    ::!tapscott::Hello and welcome to the IBM social networking booth. I’m Sacha Chua ([email removed]), an IBM consultant who helps organizations figure out what Web 2.0 is, how it fits with their strategy, how to implement it, and how to make the most of it. What did you think of Don Tapscott’s keynote? Please feel free to start a chat if you want to talk about it or if you have any questions about social networking.

    After that, you’ll be able to type !hello into anywhere and have it expanded. To update, edit shortcuts.ahk and then double-click it again.

  • Check people’s visitor histories. The visitor history will tell you about any messages sent from or to this booth, if the visitor has been to this booth before, and so on. Great way to make sure you don’t send a message twice.
  • Send people messages and invite them to chat with you. You can initiate only one chat at a time, and you have to wait for the person to accept or reject the invitation before inviting another person. You can send as many messages as you want, though, and you can have as many open chats as you want.
  • Send yourself follow-up requests after conversations. Your goal in each conversation is to find out what people are interested and give yourself an excuse to follow up. After you get that, use the [i] button on the right (your chat partner’s profile) to display the profile, then use the Followup button to send yourself a copy of the person’s visitor history. WARNING: There’s some delay when selecting names from the list, so double-check that you’re sending the right person’s information.
  • Pull in experts. Need help answering a question? Tell the visitor you’re bringing someone in, then click on the expert’s profile, choose Invite to chat, and choose the chat session you want the expert to join.

Non-obvious things:

  • Your name will not be associated with any messages (from or to), so don’t count on being able to quickly see replies from people or find out what you sent someone.
  • The sorting buttons on the lists sort only the displayed entries, not all the entries. Entries will always be arranged chronologically, although in-page sorting may be different. Don’t count on being able to use this to see all the messages sent by visitors. Just leave it on Date.
  • If someone leaves your booth while you’re trying to check their visitor history, their info box disappears.
  • As people enter and leave the booth, odd things happen to the page. Be prepared to have to find people again.
  • Things get much quieter when people are listening to sessions. Eat or rest during those times.

Saving team members from RSI

I watched Jen: Ctrl-C, Alt-Tab, click, click, Ctrl-v, click, click, click, click, click, Alt-Tab, Down, Ctrl-C… One by one, Jen copied the tasks from our Drupal planning spreadsheet to the Rational Team Concert task-tracking system.

I didn’t know if RTC had a batch import system we could use, but I’d rather do a macro using AutoHotkey instead of letting Jen copy the information one row at a time. (And with so many clicks, too!)

Fifteen minutes and some tweaking later, I have an AutoHotkey script that copies the information, creates the task, and moves to the next row. A few minutes, and I’ve copied all the rest of the tasks.

Less risk of repetitive strain injury for everyone, more interesting work, and the ability to easily handle future spreadsheets. Yay!

I show her the AutoHotkey script at work. “Coool,” she says.

Time to organize the tasks by story. Drag-and-drop to the rescue. Not easy with a mouse – Fitts’s law, small targets – but it’s easy enough with the tablet stylus. It feels natural.

Keep an eye out for the little things that you can fix with just the right tool. =)

AutoHotkey script:

F12::MakeRTCTask()
MakeRTCTask()
{
   SetTitleMatchMode,2
   CoordMode Mouse, Screen
   WinActivate, Planning
   WinWaitActive, Planning
   Send ^c
   Sleep 200
   WinActivate, IBM Rational Team Concert
   WinWaitActive, IBM Rational Team Concert
   Click 972, 346  ; add
   Sleep 500
   Click 927, 406  ; task
   Sleep 500
   Click 468, 154  ; summary text field
   Send ^v
   Send {TAB}{TAB}
   Sleep 100
   Send {DOWN}  ; filed against
   Send {TAB}{TAB}{TAB}{TAB}
   Sleep 100
   Send 1  ; priority
   Send 1
   Click 807, 125  ; save and close
   Sleep 500
   Send {PgUp}{PgUp}{PgUp}
   WinActivate, Planning
   WinWaitActive, Planning
   Send {ESC}{DOWN}
}

Update on typing: Added AutoCorrect hotkey script, now clocking in at 118wpm

While poking around the AutoHotkey installation, I found an autocorrect script. Autocorrect might help me be less twitchy about typos, which could help me speed up further. Instead of clocking in at 90wpm, I now reach 118wpm as measured on http://www.typingtest.com. There are probably some learning effects because I’m using the same typing test, but repeated practice should level that out, and trying different texts should mix it up.

AutoHotkey is pretty darn cool. One of the good things about using AutoHotkey for autocorrection is that it works across all applications (even Emacs!). I can easily tweak the AutoHotkey script to add, delete, or change substitutions.

I’ll keep track of my time over more trials as I experiment with different things. Good to play around with this!