Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

27 minutes ago, JoeViking245 said:

You shouldn't need a script to exit VPX.  As your Default Command-line Parameter, use 

-minimized -exit -play

image.png.102bdc2cc9719b1b4304a87854b00d9f.png

Then make sure you don't have anything in your Running Script section for the emulator.  Also check that your Application Path is pointing to the correct vpinballx.exe in case you have another install.

Thanks for this but it does not work for me, I have been at it all week, any idea why its just does not work ? the ahk script works but only outside of LB, and the -minimized -exit -play does nothing... it keeps going to the exit box.. right pain..

 

Link to comment
Share on other sites

  • 1 month later...

wondering if someone can help me with an ahk that i want to put in the additional apps section

i want to open an ahk telling it to open MKDX simulation server 1.0.exe and continue to run until i press the escape key to escape out of the game as usual. the hotkey to close the MKDX Server app is alt+F4 but i dont know if you use something else.

plz help

Link to comment
Share on other sites

On 11/27/2022 at 11:13 PM, Cnells2000 said:

wondering if someone can help me with an ahk that i want to put in the additional apps section

i want to open an ahk telling it to open MKDX simulation server 1.0.exe and continue to run until i press the escape key to escape out of the game as usual. the hotkey to close the MKDX Server app is alt+F4 but i dont know if you use something else.

plz help

try something like this. replace the "PATH\TO\FILE\" part with the actual file path. For example: D:\Arcade\Games\MKDX simulation server 1.0.exe

this tells the program to run, and then when the escape key is pressed it will trigger the last line which will close the program.

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
Process, Close, MKDX simulation server 1.0.exe

 

if the game has a fit about being forcefully terminated with the Process, Close command then try using a window close command instead. Replace MKDX simulation server 1.0 with whatever is the window's exact (case sensitive) title

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
WinClose, MKDX simulation server 1.0

 

  • Thanks 1
Link to comment
Share on other sites

6 hours ago, skizzosjt said:

try something like this. replace the "PATH\TO\FILE\" part with the actual file path. For example: D:\Arcade\Games\MKDX simulation server 1.0.exe

this tells the program to run, and then when the escape key is pressed it will trigger the last line which will close the program.

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
Process, Close, MKDX simulation server 1.0.exe

 

if the game has a fit about being forcefully terminated with the Process, Close command then try using a window close command instead. Replace MKDX simulation server 1.0 with whatever is the window's exact (case sensitive) title

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
WinClose, MKDX simulation server 1.0

 

Thank You! trying it now. Will This Close the ahk at the end of it all as well?

Edited by Cnells2000
Link to comment
Share on other sites

7 hours ago, Cnells2000 said:

Thank You! trying it now. Will This Close the ahk at the end of it all as well?

Hmm, sorry, forgot to consider that. Since escape is assigned as a hotkey this script is "persistent", as in runs until explicitly told to stop running.

Please add "ExitApp" as the very last line. This terminates the script, aka closes the AHK as you put it. As a whole the first suggestion would now look like this

 

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
Process, Close, MKDX simulation server 1.0.exe
ExitApp

 

  • Thanks 1
Link to comment
Share on other sites

14 hours ago, skizzosjt said:

Hmm, sorry, forgot to consider that. Since escape is assigned as a hotkey this script is "persistent", as in runs until explicitly told to stop running.

Please add "ExitApp" as the very last line. This terminates the script, aka closes the AHK as you put it. As a whole the first suggestion would now look like this

 

Run, PATH\TO\FILE\MKDX simulation server 1.0.exe
$Esc::
Process, Close, MKDX simulation server 1.0.exe
ExitApp

 

Thank You Sir!!!!!!

 

  • Game On 1
Link to comment
Share on other sites

  • 4 weeks later...

hey wondering if i could get help with a script

I want to launch D:\Emulators\Teknoparrot\Games\Wacky Races\Data\Launcher.exe

and when i push the ESC key to exit, i want to send the Alt+F4 instead. It keeps going to the dipswitch menu and i don't want to see that.

If the process; close exit App thingy works for this i can use that instead.

Thank you in advance

Edited by Cnells2000
Link to comment
Share on other sites

On 12/28/2022 at 2:40 AM, Cnells2000 said:

hey wondering if i could get help with a script

I want to launch D:\Emulators\Teknoparrot\Games\Wacky Races\Data\Launcher.exe

and when i push the ESC key to exit, i want to send the Alt+F4 instead. It keeps going to the dipswitch menu and i don't want to see that.

If the process; close exit App thingy works for this i can use that instead.

Thank you in advance

so sounds like all you want is a hotkey I think, one that turns ESC into ALT+F4 ? If so try this....

$Esc::
Send !{F4}
ExitApp

If you need to actually launch the exe through the script too, then this is needed. Launches the exe, and then whenever ESC is pressed it sends Alt+F4 to close the window

Run, D:\Emulators\Teknoparrot\Games\Wacky Races\Data\Launcher.exe
$Esc::
Send !{F4}
ExitApp

 

Link to comment
Share on other sites

On 12/30/2022 at 5:21 AM, Klopjero said:

Hi, 

I was wondering, is there a way to define a certain window title for the startup theme to wait for and then fade ?

 

I'm not aware of any tricks to do something like that. My understanding is the startup screen window is tied to the launching application's process (Application launched, now it's time for startup screen window to launch, application has closed, now it's time for shutdown screen window to launch) and I'm guessing we as users don't have the ability to change that function to work off some other window's existence, my guess is it's hard baked into LB, if you will. If the startup theme is fading out too quickly then be sure to try turning up the delay time that forces the startup screen to stay visible. If nothing changes for the better with that adjustment, then please share what game(s) or type of games, such as if they are from platform ABC or use emulator XYZ for example, that you are experiencing this issue with. Knowing a little more might help figure out what is giving you a challenge and how to resolve it.

Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...
9 hours ago, cannonwillow said:

I didn't check all through this post, but I need a script to mute VLC player when launching a game and then unmute VLC when exiting a game.  Thanks for any help.

Since LaunchBox/BigBox will pause any audio/video that is playing in its UI when you launch a game, I'm going to assume you have your installed copy of VLC playing a soundtrack/playlist/stream/whatever while perusing your collection.

If that's the case and you're using BigBox, you could (as an option) add your music files to \LaunchBox\Music\Background\ and set the option in BB to play the background music.  No extra script required to mute when launching a game.

 

AutoHotkey, innately, cannot mute a specific application (vlc.exe in your case).  There is an AHK class library that you can link to your script to (possibly??) do that.  But that's kind of a pain.  I think it would be easier to have your script Run a 3rd party app that can do this.  Or set the 3rd party app itself as an Additional Application.

From the makers of NirCmd, there's an app called Sound Volume View.  A small utility to show you more info than you ever wanted to know about your computer's audio.  But is also works with command line parameters.  It is freeware (Yes, "You are allowed to freely distribute this utility via floppy disk" lol) and it doesn't require it to be installed.

To mute vlc.exe via AutoHotkey using this app

Run "D:\where\you stored\this app\SoundVolumeView.exe" /Mute "VLC media player"

To unmute 

Run "D:\where\you stored\this app\SoundVolumeView.exe" /Unmute "VLC media player"

 

  • Like 1
Link to comment
Share on other sites

    My problem is this. I use a 43" QN90B Samsung smart TV in my Arcade Cabinet, for my main monitor. I use a 1600X900 monitor on top to display snap, marquee, game type videos. the 43" uses HDMI cable off the Computer for sound. This then feeds an amplifier inside the cabinet for the speakers. This bypasses the marquee monitor and therefore the videos playing get no sound. Then I made use of a third monitor I use to my left of the arcade cabinet. This third monitor has speakers built in. So I ran an audio cable from the marquee monitor to this third monitor. After this I would have sound playing for the marquee monitor independent of the 43" TV. I had to use the mixer to achieve sound from both outputs. Took me awhile to figure that out. But now I have music playing from the marquee videos as the game is playing its sounds through the TV. It is not muting. I had a tough time trying to get use to the navigation of Big Box, so I prefer using Launchbox at this time.  I am using the 3rd party Thirdscreen app (but only for 2 of the 3 monitors). I'm just more comfortable with Launchbox. I am always trying new ideas out and am constantly configuring things. I should mention that the other 2 monitors use display port to DVI connections. They do not have HDMI or display port.

Edited by cannonwillow
Link to comment
Share on other sites

13 hours ago, cannonwillow said:

Took me awhile to figure that out. But now I have music playing from the marquee videos as the game is playing its sounds through the TV. It is not muting.

If you run SoundVolumeView.exe then launch a game via LB (that has the 3rd monitor playing sounds), switch to SoundVolumeView.exe 

  • select one of the outputs listed and right-click and select Mute.
  • keep doing that until you find the 'source' that is feeding the 3rd monitor.
    • Probably un-mute before moving to the next one. ;) 
  • When you find the culprit, double click it and make note of the Command-Line Friendly ID:.
  • In the sample script I gave above, replace "VLC media player" with the Command-Line Friendly ID: you just found.
    • (be sure to leave inside quotes)

You [should] now have a somewhat convoluted means to mute the 3rd monitor in your somewhat convoluted setup. :D

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

I have a problem with light gun games on the Model 2 emulator, when I click the edges of the screen the emulator window loses focus and there is no way back to the game. So it got me thinking, a solution could be in AHK where the mouse gets restricted not being able to move about 10 to 20 margin of the edges of the screen. Don't know if this can be done with margin or padding or you need the exact dimensions of a 3840x2160 restricted area minus the 10 to 20 margin. I'm a real noob concerning this so please explain every step I have to make to make this work in LB, thanks so much if you will help :)

Link to comment
Share on other sites

2 hours ago, Mr. RetroLust said:

I have a problem with light gun games on the Model 2 emulator, when I click the edges of the screen the emulator window loses focus and there is no way back to the game. So it got me thinking, a solution could be in AHK where the mouse gets restricted not being able to move about 10 to 20 margin of the edges of the screen. Don't know if this can be done with margin or padding or you need the exact dimensions of a 3840x2160 restricted area minus the 10 to 20 margin. I'm a real noob concerning this so please explain every step I have to make to make this work in LB, thanks so much if you will help :)

Seems like there has to be a better [built-in] way to do this through the emulator settings.  I don't use M2, so I don't know.  (full screen? Probably not windowed-full screen [if even an option]).

 

Anyway, this script assumes you're running the game on your primary monitor and makes use of Windows' built-in ClipCursor function.  

Set limitW and limitH to the number of pixels you want the border to be.  "limitW" is your left/right border and "limitH" is your top/bottom border.  i.e. setting limitW to 20 puts a 20-pixel border on the left side AND on the right side (not 10 on each side).   Don't touch any other part of the script.  Pressing Escape will exit the script.

This gets the actual Width and Height of the monitor, then subtracts twice the limit from each, respectively.  Width - left & right border.  Height - top & bottom border.  Then using the ClipCursor function, confines the cursor movement to the coordinates supplied to it.  Coordinates for a monitor start in the upper left corner. 

With limitW and limitH both set to 20, the starting point from the upper left corner is 20 over and 20 down.  Then [for your monitor] from there it'll "draw the box confines", 3800 to the right, and 2120 down.

 

limitW := 20
limitH := 20

W = %A_ScreenWidth%
H = %A_ScreenHeight%
Lw := W - (limitW*2)
Lh := H - (limitH*2)

; Courtesy of:
; https://www.autohotkey.com/boards/viewtopic.php?p=180864&sid=79466bc66cbd4f6a4c02689d4fda46e7#p180864
ClipCursor(limitW,limitH,Lw,Lh)

ClipCursor(x,y:=0,w:=0,h:=0){
  static free := dllcall("User32.dll\ClipCursor", "ptr", 0)         ; Frees the mouse on script start up.
  static oe := {base:{__delete:func("clipcursor").bind("unclip")}}  ; For freeing the mouse on script exit.
  if (x = "unclip")
    return dllcall("User32.dll\ClipCursor", "ptr", 0)
	
  varsetcapacity(rect,16)
  numput(x,rect,0,"int")
  numput(y,rect,4,"int")
  numput(x+w,rect,8,"int")
  numput(y+h,rect,12,"int")
  dllcall("User32.dll\ClipCursor", "ptr", &rect)
}

esc::exitapp

 

To create/add this as an additional app, follow this:

 

  • Unusual Gem 1
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...