Over the last several years I've been dealing with various stages of disability thanks to ALS. My goal is to share solutions and review various products/tools/devices that I have found particularly helpful.

Tuesday, 27 January 2015

Accessing the Power of Autohotkey through Voxcommando

Back when I first mentioned voxcommando, I talked about how it can be used with autohotkey, but didn't provide an example. Honestly, I wasn't quite Happy with it for me to put public and I wanted to solve an example to do with pushing buttons in dialogue boxes. Now that I have it figured out… Here it is! :-)

Autohotkey and voxcommando example.zip

Yes, I know Python is integrated into voxcommando as a plug-in. So please don't jump on me for not using it. I chose to use autohotkey for two very specific reasons. First off, autohotkey is intended to emulated mouse and keyboard input. Which is exactly what I needed to achieve. In particular we need access to the Windows key button. Which I'm not sure can be easily achieved through Python. This is native and integral to autohotkey.

Secondly, which is a bit more off and aside. Autohotkey provides a hotstring and hotkey override/functionality. Which is particularly useful with a disability such as ALS. Because of this, I had developed a previous understanding of autohotkey.

Okay, about the example. Its core functionality is really quite simple. I create a command inside voxcommando, which is then used to execute a autohotkey scripts which passes in a command line parameter, such as "showdesktop". The command line parameter is then parsed out and the relevant bit of script is executed. Which in this case is to press Windows key and D (or in autohotkey language Send #{d} ).

In the example script, you will find examples for the snapping a window to the left, right and the four corners of your screen. Force rebooting your computer (don't worry it asks for confirmation first.) And how you can use autohotkey to pushing buttons in dialog boxes.(Eventually, I may expand it to do more. Right now it does just buttons)

I am told user account controls no longer
provides much benefit. Make it less annoying by
shutting it off
The dialogue box and button example was something I really wanted to get working. It provided more headache than expected, which is what caused the delay in publishing this article. However, the difficulty was not in the autohotkey script itself, nor voxcommando. Both of those worked beautifully. The issue was in finding a way around the user account controls provided by Windows. This was blocking the  autohotkey script to push the buttons. I tried numerous solutions and workarounds. The most successful support program was something called "UAC trust shortcut". While this worked, the functionality was erratic. Sometimes it would work, sometimes it would not. Could not figure out why. I found the best solution was to simply turn off the user account controls altogether.

What's that you say? It's a security feature? Yes it is. However, I discussed at length some of my computer programmer friends (who have much bigger brains than my own) that the security provided by user account controls is somewhat outdated and offer little benefit anymore. So would their assurances, I have turned mine off. (Don't worry. There is nothing compiled in the zip file. You can examine all the autohotkey scripts before using them).

Okay, I can get you thinking, "why is this a problem?" Well, in order for autohotkey to be able to send button commands to another dialog box. That Script needs to be run as an administrator, then the upgraded to do so, he has to come from another script.

Dont forget, if you want to give this script a try you need to install autohotkey from http://ahkscript.org/ other versions will likely not work.

Because autohotkey and voxcommando play so very well toghther, each get a thumbs up!

No comments:

Post a Comment