| Main > Main Forum |
| Need AHK script to run .bat file from key combination |
| << < (2/3) > >> |
| BadMouth:
--- Code: ---m:: run, portrait.bat n:: run, landscape.bat return --- End code --- Copy and paste that into notepad and save it as a .ahk file type. portrait.bat and landscape.bat will need to be in the same folder as the ahk script as it is written, or you can specify the full path to them and it won't matter where they are. Put a shortcut to the script in your startup folder if you boot into windows normally and haven't set up Hyperspin as your shell. It will run all the time. If you want to exit the script, you'll have to right click on the autohotkey icon in your system tray (bottom right of desktop) and exit it that way. If you need more help with autohotkey, post in the software forum. It will probably get answered faster by people who know more than me. ;D |
| brad808:
Just out of curiosity what is inside your bat file? I'm also looking to create a one button rotate from landscape to portrait and wondering how you went about it. |
| BadMouth:
--- Quote from: brad808 on December 01, 2012, 09:46:25 am ---Just out of curiosity what is inside your bat file? I'm also looking to create a one button rotate from landscape to portrait and wondering how you went about it. --- End quote --- just the command line that tells the pololu simple motor controller to move. (last number is negative for opposite direction) @echo off smccmd --speed -3200 The commands don't work directly in ahk. see below I downloaded a pdf booklet about using ahk with the pololu, but haven't looked at it. There might be a way to do it directly from the ahk script. I'm very happy with the simple motor controller. (thanks TopJimmyCooks!) It's USB and should work with new operating systems for years to come. Only hiccup I had was understanding how to set up the limit switches in the software. Even with that, I had it installed (which involved pulling and reinstalling the monitor mount in my cab) and my monitor controlled by Mala set up within a couple hours. EDIT: a quick look at the Pololu ahk guide and it turns out that the commands can be run directly, just need to put "run" in front of them (no comma) Haven't tested it, but it should go like this..... --- Code: ---m:: run smccmd --speed -3200,,Hide n:: run smccmd --speed 3200,,Hide return --- End code --- CORRECTED: Per Griffinddd's post below (In case anyone is just glancing through the thread and misses it) |
| Le Chuck:
--- Quote from: BadMouth on December 01, 2012, 11:00:20 am --- --- Quote from: brad808 on December 01, 2012, 09:46:25 am ---Just out of curiosity what is inside your bat file? I'm also looking to create a one button rotate from landscape to portrait and wondering how you went about it. --- End quote --- just the command line that tells the pololu simple motor controller to move. (last number is negative for opposite direction) @echo off smccmd --speed -3200 The commands don't work directly in ahk. see below I downloaded a pdf booklet about using ahk with the pololu, but haven't looked at it. There might be a way to do it directly from the ahk script. I'm very happy with the simple motor controller. (thanks TopJimmyCooks!) It's USB and should work with new operating systems for years to come. Only hiccup I had was understanding how to set up the limit switches in the software. Even with that, I had it installed (which involved pulling and reinstalling the monitor mount in my cab) and my monitor controlled by Mala set up within a couple hours. EDIT: a quick look at the Pololu ahk guide and it turns out that the commands can be run directly, just need to put "run" in front of them (no comma) Haven't tested it, but it should go like this..... --- Code: ---m::run smccmd --speed -3200,,Hide n::run smccmd --speed 3200,,Hide return --- End code --- (letters may be flipped depending on which way your monitor rotates...your speed may vary) --- End quote --- I need to go back and rework by TRON script if that's the case. Eliminating the bat files would stream line things a bit. No real change in performance but it's nice to have a one file solution. |
| BadMouth:
Here is a link to the Pololu AHK guide: http://www.pololu.com/docs/0J45 You can download a pdf at the top. It's only 8 pages. |
| Navigation |
| Message Index |
| Next page |
| Previous page |