How to trigger mouse down + “v” key using Javascript to use in Automator.

I am a quadriplegic with limited use of my fingers, using Maya for 3-D modeling and I am having difficulty setting up a voice command which would enable me to perform a middle mouse down event while holding down the “v” key on the keyboard. I am using Yosemite on a MacPro and would like to use my headset in Dictation along with Automator to possibly run a JavaScript to perform this operation but I am stuck on the JavaScript.

The function I am trying to perform by voice would snap a vertice or an edge which has been previously selected to the one that is selected next. If I could hold the middle mouse button and the “v” key for a certain time period and then, using the mouse with my hand, pressing no buttons there, only wiggling over the newly selected vertice or edge, the previously selected vertice would snap over to the new location! Another important part of this command would be to somehow add a “middle mouse up” event to end the command, but I haven’t gotten there yet.

In Yosemite I have enabled Enhanced Dictation. Then, in “Accessibility,” I have highlighted “Dictation" and then clicked “Dictation Commands…" I have named my new voice command “V Snap.” I assume that neither the “v” key, nor the middle mouse button are functions that I can add to a new Dictation Command in Accessibility because in pull down menu for “Keyboard Shortcut…” the only keys I can enter here are F keys and those of the extended keyboard, and pressing the middle mouse button only seems to perform the function of returning this pulldown menu to “choose…”

Moving on… Automator looks like it would be a good way to make this happen because the commands you create with Automator appear in the Dictation Commands of the Accessibility panel. I would greatly appreciate some help to please write a JavaScript which would press the middle mouse button down and hold the “v” key for five seconds, or another limited period of time, while I drag a vertice or edge with the mouse, and then release both.

THANK YOU!!!

Perhaps not what you need, but you could possibly use an Apex 350 Steelseries keyboard? https://steelseries.com/gaming-keyboards/apex-350

I have this keyboard running on a mac Yosemite and the drivers seems to be working. You have to allow it to track keystrokes in order to record macros. (It didn’t work on mac at first, but they seem to have updated the drivers?)

I can assign button clicks on the mx buttons and they react as a mouse button would. You have 4 different layers of button setups.

This is what a macro looks like in the configuration tool: