Skip to end of metadata
Go to start of metadata

Do live your life with part numbers piled up all around you? Do you have them flying at you in email, spreadsheets, csv, pdfs, schematics, and websites where you end up in a loop:


while(1) { 

Well Autohokey might be able to help with part number wrangling by giving you quick shortcuts from any application to Digikey or Google search.

What is AutoHotkey?

From their website:

 AutoHotkey (AHK) is a free, open-source macro-creation and automation software for Windows that allows users to automate repetitive tasks. It is driven by a scripting language that was initially aimed at providing keyboard shortcuts, otherwise known as hotkeys, that over time evolved into a full-fledged scripting language. 

Why use AutoHotkey?

My job constantly surrounds me with part numbers and those numbers come from all kinds of places. Repetitive processes are begging to be optimized and the constant loop of copying information to look up things on digikey.com or Google is something that occurs dozens of times a day.  Sometimes a people optimize for real time savings, sometimes they do it because they're engineers, I'm not quite sure which one this is.  This isn't, a full tutorial, just a bit of code to get your life a little more automated.

Getting Started

  1. The first steps to getting up and running would be to download and install AutoHotkey. 
  2. Then you'll need to create a text file with the .akh extension.  
  3. Write or paste your code into the that file and save it.
  4. Double-click on it to run.
  5. You're on your way to hotkey heaven.

Editing your Script

If AutoHotkey is running you should see anicon in your tray.  To edit the file at some point in the future right click on theicon and select Edit this Script.  After you make changes you'll need to save the script in your text editor and then click Reload This Script to make the changes take effect.

Running at Startup

If you want to have it run when your PC starts, put a shortcut to the file in your Windows startup folder.


On this page:
  1. Download this digikey_shortcut.ahk script file
  2. Doubleclick on the digikey_shortcut.ahk file
  3. Use Ctrl+Shift+d (digikey.com) or Ctrl+Shift+g (google.com) to search for datasheets, parts status, and buy parts faster regardless of what programs you are using at the time.

Example 1 - digikey.com search shortcut

A basic script which uses ctrl+shift+d to search Digikey.com for a bit of highlighted text might look something like this:


The basic syntax is covered here.  In the examples we'll use these keys as reference:

shorthandkeyboard mapping

The shortcut combination is expressed using a series of characters followed by a double colon ::

^+d - tells AutoHotkey to respond to the combination Ctrl+Shift+d and perform the commands after the double colon ::

Send, ^c - executes Ctrl+c (the copy to clipboard shortcut).

Sleep 150 -  It seems to need this brief delay to run reliably.

Run, http://www.digikey.com/products/en?keywords=%clipboard% - opens this webpage using the default browser on your system.

%clipboard% - inserts the contents of your clipboard.

Return - The end of a hokey command.


Highlight a part in an email and press Ctrl+Shift+d to search Digikey.com


The same with websites.

Example 2 - add google shortcut

If you wanted to add a similar ctrl+shift+g shortcut for a google search you could do something like this:

Highlight the part in a schematic or PDF and input Ctrl+Shift+g to search on google.

Example 3 - limit which programs use the shortcut

If you are a regular user of applications with their own shortcut definitions, like text editors or IDEs, you can exclude AutoHotkey from running on those windows using the .exe name, window name, or other qualifiers (learn more).

Here's an example that allows these hotkeys to run all the time except when Github's Atom text editor or SublimeText are active windows:


Other Fun Uses for AutoHotkey

Plain text paste from clipboard.

No more opening notepad to copy and paste to remove formatting.


Insert quotes around highlighted word.

Ctrl+Shift+" does this


There's a wide variety of really complex tasks which can be automated with AutoHotkey.  One can do text processing, cross program data entry and automation, abbreviation expansion, and more with AutoHotkey.  It's just one more of those tools in the tool belt for programmers, engineers, and anyone else has an obsessive need to optimize their workflows.

  • No labels