Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

I use an emulator called Teknoparrot it emulates more recent arcade games, but when it launches games even through ahk it launches the teknoparrot gui and a command window called OpenParrotLoader.exe, I want to hide these but haven't been able to. In task manger the windows are called ElfLoader and steamchild. I tried 

WinHide ahk_exe ElfLoader
WinHide ahk_exe SteamChild
WinHide ahk_exe "<My><Path><To>\OpenParrotLoader64.exe"

I also tried adding SetTitleMatchMode, 2 and with Ifwinexists but nothing seems to work although it's very possible I'm doing it incorrectly. 

Link to comment
Share on other sites

11 minutes ago, Headrush69 said:

Why not call TeknoparrotUI directly?

Inside Teknoparrot settings there is an option to hide the console.

I never realized that was an option but I just tried it and still get those windows. Unless there's another setting I checked the box  "hide console windows" saved, even restarted Teknoparrot and tried again, and tried through ahk script. 

 

Untitled.thumb.png.ee3be72f889da9eca0f7ad8e46f138a0.png

Edited by Jayinem
Link to comment
Share on other sites

8 minutes ago, Jayinem said:

I never realized that was an option but I just tried it and still get those windows. Unless there's another setting I checked the box  "hide console windows" saved, even restarted Teknoparrot and tried again, and tried through ahk script. 

 

Untitled.thumb.png.ee3be72f889da9eca0f7ad8e46f138a0.png

Are you using LB startup screens as well? If so is Aggressive hiding enabled in startup screen settings in LB?

Is it all Teknoparrot games or just Linux based ones?

I use a mix of starting TeknoparrotUI directly and RocketLauncher for a few Teknoparrot games. I’ll check when I get home my exact settings.

Link to comment
Share on other sites

4 minutes ago, Headrush69 said:

Are you using LB startup screens as well? If so is Aggressive hiding enabled in startup screen settings in LB?

Is it all Teknoparrot games or just Linux based ones?

I use a mix of starting TeknoparrotUI directly and RocketLauncher for a few Teknoparrot games. I’ll check when I get home my exact settings.

Nah I don't use any startup screens in Launchbox,  with Teknoparrot I just make an ahk of the game and compile it to exe, and add it to Launchbox. It made no difference running the exe seperate from Launchbox, so it's not really a Launchbox issue at all.  I only have free Launchbox anyway. 

Edited by Jayinem
Link to comment
Share on other sites

4 minutes ago, Jayinem said:

with Teknoparrot I just make an ahk of the game and compile it to exe, and add it to Launchbox

Looking at your previous posts, not sure for Teknoparrot why the extra step of running through an AHK. Are you using it to pre or post run apps that aren’t working in LB’s tools for that?

If you could post the AHK you are using to launch a game, that would help as well.

FYI, I learned a lot looking at the AHKs RocketLauncher uses for Teknoparrot games as it uses a more advanced window detection that might help. 
running to work, will look again after.

Link to comment
Share on other sites

1 hour ago, Headrush69 said:

Looking at your previous posts, not sure for Teknoparrot why the extra step of running through an AHK. Are you using it to pre or post run apps that aren’t working in LB’s tools for that?

If you could post the AHK you are using to launch a game, that would help as well.

FYI, I learned a lot looking at the AHKs RocketLauncher uses for Teknoparrot games as it uses a more advanced window detection that might help. 
running to work, will look again after.

Nope I just load the entire game that way Just the way I've always done it, The reason was at first I only wanted Lightgun games and they required an app called Demulshooter that only works through scripts. I started collecting other types games but I didn't learn until I was doing it for like a year there was a way to load it as an emulator in Launchbox, and I already had a bunch of scripts loaded in LB so no reason to take the time to redo it all.  You load the game in Teknoparrot and save your settings first and it makes a UserProfile .xml of the game. So 

#SingleInstance Force
SetWorkingDir, <path><to>\Teknoparrot.exe
run TeknoParrotUi.exe --profile=IDZ.xml
exit

But I don't know any of this is relevant unless you tell me loading the emulator into Launchbox prevents the additional windows from coming up, I'm pretty sure the games always launch with those windows regardless of launch method. 

Still asking my original question for a way to hide them. 

 

Edited by Jayinem
Link to comment
Share on other sites

9 hours ago, Jayinem said:

But I don't know any of this is relevant unless you tell me loading the emulator into Launchbox prevents the additional windows from coming up, I'm pretty sure the games always launch with those windows regardless of launch method. 

Still asking my original question for a way to hide them. 

Needed to know how you were starting to know what features to suggest.

Make sure you have hide console windows enabled in TeknoparrotUI settings and than also add --startMinimized to your command line options to TeknoparrotUI.exe

I understand that you don't want to change to use LB's pre run Application feature, but if you aren't running Demulshooter and your AHK is just starting TeknoparrotUI.exe, you can use the same command line arguments directly in LB.

e

Link to comment
Share on other sites

56 minutes ago, zugswang said:

This does not work for me either even with hide console windows.

That sucks. These are the worst problems when it works for some but not others. Teknoparrot can be a pain version to version. Only thing I could suggest would check your ParrotData.xml file and make sure you do indeed see <SilentMode>true</SilentMode>

1 hour ago, zugswang said:

Many Teknoparrot games also cannot use the fade screens , e.g. Batman as once game loads it only plays the sound (for me anyway)

Until they fix it within the emulator itself, we are stuck with a messy loading screen.

I've been flipping between using multiple ways to start my Teknoparrot games (haven't decided on my favourite yet), but if you're so inclined, using RocketLauncher with it's loading screens always worked for me. It uses a more active window searching feature.

1 hour ago, zugswang said:

Also some games like Mario Kart DX take a few minutes to load, so it's useful for screen to show on those games or you would think it was not going to load at all.

OMG, that game takes forever to load through Teknoparrot doesn't it. For games that have the option, (like Mario Kart DX), I try to use JConfig, as it loads faster. 

Link to comment
Share on other sites

22 minutes ago, zugswang said:

That is using jconfig ?

LOL. I did say faster, not that it was fast. ;)

Best option... play Mario Kart 8 with Cemu instead. :) 

I keep Mario Kart DX in the collection, but personally found it a bit boring and bland and other games that load faster are more fun.

Link to comment
Share on other sites

  • 2 weeks later...

Hey everybody.  I need a little help with a script.  I use Big Box on an arcade machine and am using an app called Xinput to Xarcade to turn keypresses into xbox controller buttons (couldn't get the ipac xinput thing figured out and this works really well) and I use a nifty little script to auto launch it at the start of a game and close it upon exiting the game.  Some of my PC games, SFV, MKXL, MK11, do not realize the game has quit and LED Blinky doesn't quit the custom game button color animation...I would like to add a command within the script to stop and restart LEDblinky at the when I press escape and exit the game...Can someone give me a hand.  My script is below

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

Escape::
Process, Close, StreetFighterV.exe

if WinExist("LaunchBox Game Startup")
{
WinActivate
WinWaitClose, LaunchBox Game Startup
}

if WinExist("LaunchBox")
{
WinActivate
}

if WinExist("LaunchBox Big Box")
{
WinActivate
}

ExitApp
return

Link to comment
Share on other sites

  • 2 weeks later...

any pros out there that can help me with the below script? and thank you very much in advance!

 

i found this online and it works great.  it sends keystrokes based on joystick pushes, in this case, arrow keys for directions.  i'd like to modify this so that it is listening for two different joysticks, not just the one.  for the second stick (ID 3), i want it to send keystrokes for up down left right to keys E,D,F,G

i tied adding this to the body of the script but then neither stick was working.  i realize this add is still sending up down left right cursor keys, but i was just testing to see if it would work.

if (3JoyX > 70)
    KeyToHoldDown := "Right"
else if (3JoyX < 30)
    KeyToHoldDown := "Left"
else if (3JoyY > 70)
    KeyToHoldDown := "Down"
else if (3JoyY < 30)
    KeyToHoldDown := "Up"
else
    KeyToHoldDown := ""

 

here is the one stick working script:

#Persistent  ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
JoyX := GetKeyState("JoyX")  ; Get position of X axis.
JoyY := GetKeyState("JoyY")  ; Get position of Y axis.
KeyToHoldDownPrev := KeyToHoldDown  ; Prev now holds the key that was down before (if any).

if (JoyX > 70)
    KeyToHoldDown := "Right"
else if (JoyX < 30)
    KeyToHoldDown := "Left"
else if (JoyY > 70)
    KeyToHoldDown := "Down"
else if (JoyY < 30)
    KeyToHoldDown := "Up"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  ; The correct key is already down (or no key is needed).
    return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return

$Esc::

{

    Process, Close, {{{StartupEXE}}}

}

Link to comment
Share on other sites

Hi @d8thstar

 

Try the following - semi untested - So you might need to move the key bindings around a bit

#Persistent  ; Keep this script running until the user explicitly exits it.
#SingleInstance Force
SetTimer, WatchJoy1, 5
SetTimer, WatchJoy3, 5
return

WatchJoy1:
1JoyX := GetKeyState("1JoyX")  ; Get position of X axis.
1JoyY := GetKeyState("1JoyY")  ; Get position of Y axis.
KeyToHoldDownPrev := KeyToHoldDown  ; Prev now holds the key that was down before (if any).

if (1JoyX > 70)
    KeyToHoldDown := "Right"
else if (1JoyX < 30)
    KeyToHoldDown := "Left"
else if (1JoyY > 70)
    KeyToHoldDown := "Down"
else if (1JoyY < 30)
    KeyToHoldDown := "Up"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  ; The correct key is already down (or no key is needed).
	return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return


WatchJoy3:
3joyX := GetKeyState("3joyX")  ; Get position of X axis.
3joyY := GetKeyState("3joyY")  ; Get position of Y axis.
KeyToHoldDownPrev := KeyToHoldDown  ; Prev now holds the key that was down before (if any).

if (3joyX > 70)
    KeyToHoldDown := "G"
else if (3joyX < 30)
    KeyToHoldDown := "F"
else if (3joyY > 70)
    KeyToHoldDown := "D"
else if (3joyY < 30)
    KeyToHoldDown := "E"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  ; The correct key is already down (or no key is needed).
	return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return

$Esc::

{

    WinClose, ahk_exe {{{StartupEXE}}}

}

I have changed away from Process, Close, as it isn't recommended anymore as it can cause issues, so hopefully this will still close it for you

Link to comment
Share on other sites

9 minutes ago, d8thstar said:

thanks man.  unfortunately, P1 movement is like the key is being pressed once instead of being held.  haven't tried P2 yet...

Not sure why that is. Using same script as your original one so should in theory work same way as it did before. (ie if it held down the key before it should now)

Just tested it here on two joysticks and worked as if they key was being held in.

Maybe try it as two separate ahks one for each joystick and see if that works before combining them.

 

Edited by Kiinkyfoxx
Link to comment
Share on other sites

  • 2 weeks later...

what if I went the other way with this.  i can set up ccs64 to see both joysticks just fine but then it's in joystick mode (not keyset) and listening for joystick buttons.

so, can a AHK script send joystick button presses with a keystroke?

If anyone can help a noob, I would REALLY appreciate it!

FYI, CCS64 sees my sticks as joystick 1 and joystick 3.  For joystick one button 1, I am using the 'n' key.  For joystick 3, button 1, i am using the 'w' key.

 

Link to comment
Share on other sites

I've tried to search through everything, but can't figure out what I'm doing wrong. So I've figured out how to create a UCR Start and Stop ahk for a specific game, but can't figure out how to apply this to an Emulator. I have about 400 mame games I want this to run on through Retroarch, ie I would have to setup each game in mame to accomplish this, which I don't mind just thinking if I have to change something 1 v 400 is a lot nicer.

If there is a better way to automatically turn on UCR on the start of LaunchBox/Big Box and then turn it off for about 10 games so I can connect Xbox controllers to? I can't figure out the best combo to make both of these setups work. I would ideally love my ipac/mini pac arcade controls to work on all games, but that isn't gonna happen. Some Steam games have such a tough time dealing with UCR I have to have two Xbox 360 controllers on standby to use for these games and UCR has to be off for them to connect properly and work.

I've tried putting in the script to the "Running AutoHotkey Script" tab and it kinda works in terms of asking me to unblock UCR (I ran the unblocker in the folder and that didn't work also tried running as admin didn't work). Nothing else I do seems to impact that tab to run an ahk. Is there a specific command line I can use? Is my ahk bad (attached the script)? Any help to push me forward would be greatly appreciated! 

UCRStart 1.ahk

Edited by IronMan8Bit
Link to comment
Share on other sites

  • 2 weeks later...

i've tried the below, doesn't seem to work.  I'm just looking for a very simple, click "n", send left mouse click.  i'm putting this under the manage emu, "ruuning autohotkey script" but it doesn't seem to work.  fyi, trying this for american laser games running singe 2.0. 

trackball is working fine as the mouse cursor, and an actual mouse left click shoots, but i want to map to one of my arcade buttons.

maybe it's because games start with a bat?  i dunno, any help is appreciated. this is what i've tried (along with many similar alternatives)

n::click

Link to comment
Share on other sites

 

12 minutes ago, d8thstar said:

maybe it's because games start with a bat? 

Yup. More than likely.   LaunchBox starts the 'game' (in your case the batch file) and executes the Running AutoHotkey Script.  Once the 'game' exits, LB closes/exits the script.  In this case, the batch file starts the game and then Exits itself.  LB see the 'game' [batch file] exit, and bam!  No more running script.

One option (and probably the easiest to implement):   To keep your batch file "alive", add in a   /w   on the start line.

start /w "" myGame.exe

This will wait for "myGame" to exit before 'exiting' (or continuing any subsequent commands in) the batch file.

Link to comment
Share on other sites

Hey Everyone Im Trying to figure how to make a script where once i click the .bat, it waits 2 minutes before beginning then i need it to push the down key every 17 seconds or so repeating for at least 4 hours. i know. its crazy but i need it. can someone help me please?

Link to comment
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...