Jump to content
LaunchBox Community Forums
Aevans0001

Launchbox Autohotkey script issue.

Recommended Posts

So I just moved my installation of everything over to a new computer and everything was going good until I noticed my ahk wasn't working on commodore 64.  @Jason Carr was there anything done to running ahk from the emulators settings lately?

 

So what I am trying to do is run joytokey.exe with a particular profile before I run winvice, and then closing joytokey upon exit of winvice.  This used to work, however now I can not get it to. 

 

My current ahk script reads this

Run, "C:\games\joytokey\joytokey.exe"
WinWait, ahk_exe x64.exe
WinWaitClose  ; Wait for the exact window found by WinWait to be closed.
Run, "C:\games\joytokey\joytokeykill.bat"

everything seems to work  except the joytokeykill.bat does not run.  Also you may notice that Joytokey.exe does not run a particular profile.  I would love it to choose just a profile, but when I set it up I could not get it to work, so any help there would be great also.

 

My file JoytoKeykill.bat does work if I manually load it.

Share this post


Link to post
Share on other sites

u should replace joytokeykill.bat with something like this:

 

start "" /WAIT "somegame.exe"
Timeout 1
taskkill /f /im JoyToKey.exe

By using start WAIT, "somegame.exe" can be name of emulator

or.. most easiest maybe would be to put all on escape?

$Esc::
{
  Process, Close, joytokill.exe
}

 

or u can use

if WinExist("ahk_exe someprogram.exe")
DO..

@Aevans0001

P.S

just remembered , there is also little hard way to check if process is active then Do..

TIMEOUT /T 3
:while1
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %GAMENAME%"') DO IF %%x == %GAMENAME% goto FOUND
goto FIN
:FOUND
TIMEOUT /T 5
goto :while1
:FIN
taskkill /f /im joytokill.exe

define emulator as %GAMENAME% set "GAMENAME=someprogram.exe"

Anyway there are bunch of choices to deal with it

Edited by Undertherainbow

Share this post


Link to post
Share on other sites
5 hours ago, Undertherainbow said:

u should replace joytokeykill.bat with something like this:

 


start "" /WAIT "somegame.exe"
Timeout 1
taskkill /f /im JoyToKey.exe

By using start WAIT, "somegame.exe" can be name of emulator

or.. most easiest maybe would be to put all on escape?


$Esc::
{
  Process, Close, joytokill.exe
}

 

or u can use


if WinExist("ahk_exe someprogram.exe")
DO..

@Aevans0001

P.S

just remembered , there is also little hard way to check if process is active then Do..


TIMEOUT /T 3
:while1
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %GAMENAME%"') DO IF %%x == %GAMENAME% goto FOUND
goto FIN
:FOUND
TIMEOUT /T 5
goto :while1
:FIN
taskkill /f /im joytokill.exe

define emulator as %GAMENAME% set "GAMENAME=someprogram.exe"

Anyway there are bunch of choices to deal with it

how do I define the emulator and game name?  I am running this for every game in c64.

Share this post


Link to post
Share on other sites

Sorry, I am completely confused now..

 

Do i put the whole thing in?

 

TIMEOUT /T 3
:while1
FOR /F %%x IN ('tasklist /NH /FI "IMAGENAME eq %GAMENAME%"') DO IF %%x == %GAMENAME% goto FOUND
goto FIN
:FOUND
TIMEOUT /T 5
goto :while1
:FIN
taskkill /f /im joytokill.exe
$Esc::
{
  Process, Close, {{{StartupEXE}}}
  Process, Close, joytokill.exe
}
define emulator as %GAMENAME% set "GAMENAME=someprogram.exe"

like that, or are you saying just do this now

$Esc::
{
  Process, Close, {{{StartupEXE}}}
  Process, Close, joytokill.exe
}

 

Share this post


Link to post
Share on other sites

@Aevans0001

Just open ahk under emulator in launchbox and paste

$Esc::
{
  Process, Close, {{{StartupEXE}}}
  Process, Close, joytokill.exe
}

when u press Escape it will close both emulator and joytokey

Edited by Undertherainbow

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...