Chocolatey + AutoHotKey = Chocolatey Hotkey (CHK)

UPDATE as of 8/10/2015 9:56:14 AM by AD: I have made a lot of changes to CHK since writing this post, so I just updated it to reflect those changes. If you’re coming here a second time for reference, please take a lot at my second post about CHK.


 

Wouldn’t it be cool if anyone could quickly and easily install one of your AHK scripts on their own computer?  Or imagine sitting down at someone’s computer and typing a simple command to install an AHK script that you find useful.  And wouldn’t it be cool if others could contribute to this mechanism to create a community of easily installable and maintainable scripts?!?!?

You can now, with Chocolatey Hotkey (CHK). CHK is, essentially, a package manager for AutoHotKey scripts that utilizes Chocolatey for distribution. It is also a great way to modularize your scripts as plugins instead of having one big AHK script that you have to maintain. 

UPDATE as of 7/23/2015 4:40:11 PM by AD.  I included a reference to the yeoman generator I just created which goes a long way towards making it easier to create CHK plugins.

An example

I’ve published a CHK plugin that maps WIN+SHIFT+I to Chrome.  If you want that same functionality on your computer:

  1. Install Chocolatey if you haven’t already. Chrome must also be installed for this to work.
  2. Open up an administrator command prompt
  3. Type  choco install chk-default-winshifti-chrome -version 1.0.0
  4. Press Enter.
  5. Follow the prompts until everything is installed.
  6. Press WIN+SHIFT+I on your keyboard to launch or activate Chrome.

TADA! That’s it!

CHK and all of its plugins run as a new, single AHK script in your system tray:

If you don’t like the WIN+SHIFT+I plugin, you can easily uninstall it with  choco uninstall chk-default-winshifti-chrome !!!

Note that the  -version 1.0.0 stuff is only temporary until the chocolatey packages are officially moderated and approved.

Other CHK plugins

For the time being, the following CHK plugins are available:

  • chk-default-winshiftk-outlook
    Runs or activates Outlook on WIN+SHIFT+K.
  • chk-default-winshiftl-blankscreen
    Starts the blank screensaver.
  • chk-default-dt-fordatetime
    Enters the current date and time wherever you type “dt” (without quotes). For example, “7/23/2015 12:14:28 PM:   “

Creating your own CHK plugins

I’ve done my best to make this as easy as possible. I can create a new CHK plugin easily in about 2 minutes.

Prerequistes

  • It is helpful to have some understanding of chocolatey and the package creation process. For more information, see https://github.com/chocolatey/choco/wiki/CreatePackages.
  • You will need a chocolatey account, and you will need to configure your personal API key on your computer.
  • For the sake of this example, it is helpful to have an understanding of github.
  • Also, it is helpful to have had some experience with PowerShell.

Option 1

  1. Copy, paste, and edit an existing plugin.

8/10/2015 9:49:07 AM by AD:   I’ve made a lot of changes to CHK since writing this post, and so there is no longer a template that you can use to create a plugin. The preferred technique for creating a plugin is the yeoman generator below.

The simplest possible example of a CHK plugin for reference can be found at https://github.com/alexdresko/chocolatey-hotkey/tree/master/chocolatey-packages/chk-default-dt-fordatetime.

Option 2

Option 2 is very similar to Option 1, except steps 1-6 in Option 1 are done for you with the yeoman generator I created.

To see what that’s like, head on over to my second post about CHK.

Now what?

Great question! I’d love to know what you think about Chocolatey Hotkey! Does it fit your needs? What kinds of plugins would you like to see in CHK? How might I improve CHK?

And, of course, you’re more than welcome to contribute. I made CHK open source on github to allow community contribution… and I’m looking forward to see what you do with this!