Build Your Own Arcade Controls Forum
Main => Main Forum => Topic started by: griffindodd on November 28, 2012, 11:39:19 pm
-
HI guys,
I need to execute a .bat script that I use to rotate my monitor by hitting a shifted key combination on my control panel.
e.g
- Shifted P1 Joystick left initiates my 'Portrait Mode' .bat script
- shifted P1 Joystick right initiates my 'landscape Mode' .bat script
I'm pretty bad at AHK can anyone help me out?
-
What button does "Shifted P1 Joystick left" post as in windows?
-
Shifted P1 left is 'm'
Shifted P1 right is 'n'
I have two scripts, one for each direction called landscape.bat and portrait.bat
-
If you are using MALA, why not just automate it using MRotate?
-
I'm using Hyperspin
-
m::
run, portrait.bat
n::
run, landscape.bat
return
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
-
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.
-
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.
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.....
m:: run smccmd --speed -3200,,Hide
n:: run smccmd --speed 3200,,Hide
return
CORRECTED: Per Griffinddd's post below (In case anyone is just glancing through the thread and misses it)
-
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.
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.....
m::run smccmd --speed -3200,,Hide
n::run smccmd --speed 3200,,Hide
return
(letters may be flipped depending on which way your monitor rotates...your speed may vary)
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.
-
Here is a link to the Pololu AHK guide:
http://www.pololu.com/docs/0J45 (http://www.pololu.com/docs/0J45)
You can download a pdf at the top. It's only 8 pages.
-
Thanks for this guys, haven't had chance to fart this weekend but I'll give it a try when I get a chance.
-
Almost right, you need a space before the run command like this
m:: run smccmd --speed -3200,,Hide
n:: run smccmd --speed 3200,,Hide
return
-
Is it possible to read key presses with AHK? This could help folks who are using this method but need switched inputs to tell the PC which orientation the monitor is in. If you have some unused inputs on your keyboard emulator (keywiz, etc), you could get input through those.
-
Is it possible to read key presses with AHK? This could help folks who are using this method but need switched inputs to tell the PC which orientation the monitor is in. If you have some unused inputs on your keyboard emulator (keywiz, etc), you could get input through those.
Autohotkey's power is limitless! :notworthy:
http://www.autohotkey.com/docs/commands/GetKeyState.htm (http://www.autohotkey.com/docs/commands/GetKeyState.htm)
After you modified Malaori3 for me, someone turned me onto the iniswap command in ahk.
It swaps variables into ini files.