Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Cpviewer help  (Read 1335 times)

0 Members and 1 Guest are viewing this topic.

gonzo90017

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1034
  • Last login:June 23, 2019, 02:41:07 pm
  • I'm a llama!
Cpviewer help
« on: May 28, 2007, 03:11:19 am »
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

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:July 12, 2012, 06:50:45 pm
Re: Cpviewer help
« Reply #1 on: May 28, 2007, 01:01:24 pm »
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.
« Last Edit: May 28, 2007, 10:22:50 pm by Dmod »
My Projects:
Suspended Animation Scratch-built Cab
Driveshaft Arcade Seat Platform

Dmod

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 315
  • Last login:July 12, 2012, 06:50:45 pm
Re: Cpviewer help
« Reply #2 on: May 29, 2007, 02:54:20 am »
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




« Last Edit: May 29, 2007, 03:13:32 am by Dmod »
My Projects:
Suspended Animation Scratch-built Cab
Driveshaft Arcade Seat Platform

gonzo90017

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1034
  • Last login:June 23, 2019, 02:41:07 pm
  • I'm a llama!
Re: Cpviewer help
« Reply #3 on: May 29, 2007, 03:22:30 pm »
Thank's i'll try it tonight.