Doing an Internet Search for the Current Word in Visual Studio with AutoHotkey

I got bored in Visual Studio double clicking a class, copying to clipboard, then heading to browser then pasting into search box.

I wanted to be able to quickly search for something (e.g. in Google) for whatever word the cursor was currently in. Also in other applications.

I have a Microsoft keyboard that has a calculator key that normally opens the Calculator application. I’ve never ever used this and hadn’t even noticed it until now.

image of the calculator key on my keyboard

To map this key in AutoHotkey, “Launch_App2” can be used, so to trigger a script whenever it’s pressed: Launch_App2::

I also wanted the default behaviour to automatically go to the first result. Pressing CTRL-calckey just does a normal search and lists all the results for me to peruse.

Here’s the script – note that it’s a bit rough and ready, for example it uses the clipboard (CTRL-C) so this will overwrite anything you have in it. It also won’t work if the cursor is at start of line, etc.

Launch_App2:: ; Do an I'm Feeling Lucky Google search when calc key pressed
  Clipboard := 

  SendInput, ^{LEFT}^+{RIGHT}
  SendInput, ^c
  ClipWait, 1

  if !(ErrorLevel)  { 
      Run, % "https://www.google.com/search?hl=en&btnI=I%27m+Feeling+Lucky&&q=" Clipboard
  }
return



^Launch_App2:: ; Do a normal Google search when calc key pressed
  Clipboard := 

  SendInput, ^{LEFT}^+{RIGHT}
  SendInput, ^c
  ClipWait, 1

  if !(ErrorLevel)  { 
      Run, % "https://www.google.com/search?hl=en&q=" Clipboard
  }
return

Now if i have my cursor in the word “ActionResult” in Visual Studio, hitting the calculator key takes me to MSDN http://msdn.microsoft.com/en-us/library/system.web.mvc.actionresult%28v=vs.118%29.aspx as this is the first Google search result for “ActionResult”.

 

If you’ve never used AutoHotkey before, to get started check out my Pluralsight course.

SHARE:

Using Glide Paths to Increase Productivity

I first became aware of the concept of “glide paths” in Getting Results the Agile Way. A glide path is an aeronautical term meaning: “the course followed by an aircraft or spacecraft when descending for a landing.” – Dictionary.com

Usually this refers to a low/no power descent which requires little effort.

Applying this concept to the work we do essentially means doing the harder/boring/tougher/difficult/unpleasant things earlier in the week so that towards the end of the week we are “gliding”, with less effort required as we’ve already done the worse tasks.

In addition to applying glide paths to the week, we can apply this to individual days: doing the tougher things at the start so as we get closer to finishing for the day, our tasks get easier.

The same thinking can also be employed by agile teams, for example doing the harder things earlier in the sprint.

The following diagram shows as we get more tired during the week, how the duration of a given task may increase:

image

This is not always the case obviously, everyone has different energy patterns, but becoming more self-aware we can apply ourselves to different kinds of work at the times where we get get the most output. Also it’s interesting that it may be better to do tasks requiring creativity when we’re tired.

Glide paths assume that we have some autonomy over the prioritisation of our tasks, even when we do have autonomy we my have little choice sometimes about when things get done. Even so, glide paths are a useful concept to have in our productivity toolboxes.

SHARE:

Save Keystrokes with AutoHotkey Hotstrings

AutoHotkey is a free open source tool that does all kinds of cool things, one of which is hotstrings.

Hotstrings allow us to define shorthand phrases that get expanded into full text. For things we type often, creating hotstrings can save us valuable keystrokes.

Once AutoHotkey is installed, we can edit the script and add our hotstrings.

So, if we typed “dontcodetired.com” often, we could define a hotstring like this:

::dct::dontcodetired.com

Now when we type “dct” followed by an ending key such as space or enter, the “dct” gets auto-replaced with “dontcodetired.com”.

If we want the replacement to happen as soon as the last character is typed (in this case the “t”) and not have to press an ending key we add an asterisk after the first colon:

:*:dct::dontcodetired.com

Now as soon as the “t” key is pressed the replacement happens immediately.

 

To find out more about hotstrings and the other cool features of AutoHotkey, check out my Pluralsight course: Personal Productivity & Performance Tools for Windows Developers

SHARE:

Kill Your Productivity Demons with my New Pluralsight Course

My new Pluralsight course Personal Productivity & Performance Tools for Windows Developers “get more done in less time” has just been released.

It covers a range of developer-focused and general productivity tools that you can mix and match to suit your way of working.

“We’re constantly under pressure to be more productive. Learn how to use these tools to improve your productivity, streamline your workflows, and get more done in less time. ”

The course consists of:

  • Reduce Typing with AutoHotkey
  • LINQPad – A C# / VB.NET Scratchpad
  • Starting Programs and Websites with SlickRun
  • Take Control of your Clipboard with ClipX
  • Remember What you Did with TimeSnapper
  • Making the Internet Work for You with IFTTT
  • Free Image Editing with Paint.NET

You can find this course along with my other courses on the Pluralsight author page.

SHARE:

What are Your 3 Wins for 2014?

The idea of "the power of three" is a universal concept; it can be seen anywhere from religion (The Holy Trinity, Triquetra, etc.) to childhood learning ("ABC", "123") to entertainment (The Three Musketeers, The Three Stooges, etc.) to project management (the scope-cost-schedule triangle).

One simple way to exploit the power of three is to define outcomes/wins/achievements. These "three wins" can be at any level:

  • Three wins for the project
  • Three wins for the year
  • Three wins for the month
  • Three wins for the week
  • Three wins for today

The three chosen things should not be simple tasks to be ticked off, they should be things that feel like a "win" and give a real sense of progress and satisfaction.

The "wins" should be realistic and achievable.

Getting Results the Agile Way by J. D. Meier makes extensive use of the power of three with its "Monday Vision, Daily Outcomes, Friday Reflection" and three types of "Hot Spot".

The power of three can also be applied to individual items of work/features being developed, for example a feature can be evaluated by: user value, business value, technical value. In agile team retrospectives the power of three can be used to decide: what went well, what didn't go well, what will be improved upon in the next iteration.

(the above is an excerpt from my book Keeping Software Soft)

My 3 Wins for 2014

These are my 3 (professional) wins for 2014 (in no particular order):

While these aren’t my only wins for the year, they are things that I feel if I accomplish them, when I see in 2015 I can look back and be content.

It’s also important to be flexible with plans, if professional or personal events happen that mean I really can’t accomplish these then that’s ok: no plan survives contact with the enemy.

 

Make some time to think about and write down your 3 wins for 2014 and feel free to share them in the comments.

SHARE: