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: help with bat file? maybe even ahk?  (Read 1674 times)

0 Members and 1 Guest are viewing this topic.

tony.silveira

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 697
  • Last login:September 27, 2024, 03:04:35 pm
    • my baby
help with bat file? maybe even ahk?
« on: January 11, 2016, 01:24:02 pm »
Hi all,

Can anyone help me in writing a BAT file to launch a couple of programs?  A few of the emulators that I run in Hyperspin are launched as executables outside of rocket launcher so I can’t use that functionality.

What I want to do is run uconfig in order to reprogram my uhid64 before the game starts.  My system in question is American Laser Games and each game seems to have its own bat and exe files.  I need to figure out which is called at launch but basically what I need is to launch uconfig and then launch the bat (exe) for the game.  I have tried something like the below but it doesn’t seem to work.  Even just the first part doesn’t work UNLESS the uconfig.exe is in the same folder as the bat, which, makes no sense to me because I am CD’ing into the needed directory.

@echo
cd d:\tools\uconfig
Start “” “uconfig.exe mouse.hid”
cd “r:\american laser games”
Start “” “crimapatrol.exe”

I *may* need to use AHK because when the emu closes, I want to reprogram back and with AHK, it can listen to window names.  but I simply want to get the first step done and then i'll worry about step 2.

thanks all!

EMDB

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 865
  • Last login:September 05, 2023, 09:18:51 am
  • Project RetroCade
Re: help with bat file? maybe even ahk?
« Reply #1 on: January 11, 2016, 02:45:12 pm »
You can't do "cd d:\tools\uconfig"...

Try it on the command line yourself. You first need to switch drives and than do the change directory (cd). As you look at the full command name it is even logical although very convenient sometimes.

So you need to
d:
cd \tools\uconfig (no need for quotes if no spaces in the path name)
uconfig mouse.hid (no need for start, .exe or quotes here too)
r:
cd "\american laser games"
crimapatrol (no need for start, .exe or quotes here too)




DrakeTungsten

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 287
  • Last login:August 14, 2022, 06:36:45 pm
  • I effed with the wrong person!
    • No Quarter - a basic FE, WIP
Re: help with bat file? maybe even ahk?
« Reply #2 on: January 11, 2016, 10:16:51 pm »
You can cd to a different drive with the /d switch:
cd /d d:\tools\uconfig

"crimapatrol (no need for start, .exe or quotes here too)"
But if you don't use start, then the dos box persists until crimepatrol exits. The dos box might be immediately concealed behind the game anyway, but it's a useful habit for me, anyway, to always use start when it's the last line of a batch file launching a game.
« Last Edit: January 11, 2016, 10:27:24 pm by DrakeTungsten »
No Quarter - a basic FE, WIP

Thenasty

  • Trade Count: (+17)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 4419
  • Last login:Yesterday at 11:50:31 am
    • Thenasty's Arcademania Horizontal/Vertical monitor setup.
Re: help with bat file? maybe even ahk?
« Reply #3 on: January 11, 2016, 10:41:21 pm »
just do

@echo off
d:\tools\uconfig\uconfig.exe mouse.hid
r:\american laser games\crimapatrol.exe

Thenasty's Arcademania Horizontal/Vertical setup.
http://forum.arcadecontrols.com/index.php?topic=26696.0

Free VGA Breakout Cable
http://forum.arcadecontrols.com/index.php?topic=38228.0

Ultimate All in One Coin Mech write up (Make your own)
http://forum.arcadecontrols.com/index.php?topic=19200.0

EMDB

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 865
  • Last login:September 05, 2023, 09:18:51 am
  • Project RetroCade
Re: help with bat file? maybe even ahk?
« Reply #4 on: January 12, 2016, 01:48:55 am »
You can cd to a different drive with the /d switch:
cd /d d:\tools\uconfig

"crimapatrol (no need for start, .exe or quotes here too)"
But if you don't use start, then the dos box persists until crimepatrol exits. The dos box might be immediately concealed behind the game anyway, but it's a useful habit for me, anyway, to always use start when it's the last line of a batch file launching a game.
He wants to call uconfig again after crimepatrol exits to reset the configuration so without start it can be added after the call to crimepatrol....

just do

@echo off
d:\tools\uconfig\uconfig.exe mouse.hid
r:\american laser games\crimapatrol.exe
Some applications need to have the working directory set to their own that is probably why he needs the cd.

tony.silveira

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 697
  • Last login:September 27, 2024, 03:04:35 pm
    • my baby
Re: help with bat file? maybe even ahk?
« Reply #5 on: January 13, 2016, 03:56:10 pm »
Thank you all for the great responses, I did get it to work, I wish it were a bit cleaner but it does what I need it to.
I had to modify each BAT for all of the American Laser Games (9 I think total).  So now each game calls to an AHK I was able to get working.  The AHK runs my key reprogram then I used winwait to keep an eye on any window that starts with “DAPHNE”.  When daphne closes, AHK senses and triggers the reprogram back.
The BAT continues to load the game as AHK waits in the wings, listening to the daphne window.
So not a huge deal as there were only 9 games but if I wanted to do something similar for an emu system wide, well… it would certainly be easier with pre/post emu commands within HS but if they are there, I can’t find them.