| Main > Software Forum |
| Cpviewer help |
| (1/1) |
| gonzo90017:
Can cpv2 exit using usb gamepads? I set up button 3 to launch cpv2 and it works but when I press it again to exit, it wont. I tried every button but nothing. It only exits when I press a keyboard button. Since my projecI won't be using a keyboard, only gamepads, that's my problem. |
| Dmod:
For what it's worth, I have exactly the same problem and posed the same question on the Main board yesterday. I also tried Johnny5 but it seems to only detect keyboard presses as well. ::edit:: After searching the boards, it seems like AutoHotKey can be used to convert the joystick buttons into keypresses. I'm going to play around with this a bit but I think you can write a batch file that calls CPViewer and AHK. AHK can convert the button press to close CPViewer and then exit. |
| Dmod:
I got this working. In my setup I'm using MaLa to launch CPV2 and needed a way to close it. I created a 2-line batch file which MaLa calls as "mycpv2.bat -r=%parent%". The batch file looks like this: mycpv2.bat: --------------- start test.ahk cpv2 %1=%2 Test.ahk is an AHK script file that waits for my P2 start button to be pressed (I'm using Joystick 2 Button 7). Once pressed, the script checks to see if CPV2 is the active window. If so, it sends a keypress (I used "_") to CPV2 and loops to make sure CPV2 closes. Once closed, the script kills itself. Here's my AHK script. The part labelled "2Joy7::" is the relevant part. The other part labelled "`::" just allowed me to find out the title of the CPV2 window and is not necessary. I tested this out a lot with MaLa tonight and it appears to be stable. Hope this helps. -D test.ahk: ----------- ; ; AutoHotkey Version: 1.x ; Language: English ; Platform: Win9x/NT ; Author: A.N.Other <myemail@nowhere.com> ; ; Script Function: ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder) ; #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. 2Joy7:: WinGetActiveTitle, Title if (Title = "CPV2 Viewer") { Loop, 100 { Send _ WinGetActiveTitle, Title if (Title <> "CPV2 Viewer") { ExitApp } } } Return `:: WinGetActiveTitle, Title Run Notepad WinWait Untitled - Notepad WinActivate Send %Title% Return |
| gonzo90017:
Thank's i'll try it tonight. |
| Navigation |
| Message Index |