Fablog Posted October 21, 2017 Share Posted October 21, 2017 Guys, how to start UCR in the background at a Windows game launch and terminate it when exit? Quote Link to comment Share on other sites More sharing options...
Zombeaver Posted October 30, 2017 Share Posted October 30, 2017 This is a script I made for CCS64 (Commodore 64 emulator), designed to be used with a 360/XB1 controller. The script adds these functions to two controllers (1Joy# and 2Joy#). If you want to add it to only one, just eliminate the sections for 1Joy# (marked in red) or 2Joy# (marked in blue). If you want to see what number AHK sees your joystick as (1, 2, 3, etc.) you can use this script to test. Note that you'll need to update your paths for NoMousy (bolded below) as mine is specific to my computer. You can also just remove them if you don't want to use NoMousy. I use it primarily for Big Box because occasionally (not always) a Windows loading cursor (the spinning circle) will be visible when starting CCS64 from BB, it doesn't seem to happen in LB. What the script does: starts NoMousy on launch, maps several CCS64 functions to various buttons/combinations of buttons, and exits NoMousy when quitting. A = Fire (natively in CCS64) B = Esc (which translates to RunStop in-game) Start = Space Left thumb stick button = n Right thumb stick button = y Back + Y = Next Disk Back + X = Previous Disk Back + Left Bumper = Exit CCS64 Back + Right Bumper = Swap joystick ports ___________________AHK Script Below___________________ #NoEnvRun, X:\Emulation\LaunchBox\Nomousy\nomousy.exe /hide SetKeyDelay, -1, 110 1Joy8::Send {Space} 1Joy2::Send {Esc} 1Joy9::Send {n} 1Joy10::Send {y} ;Next Disk 1Joy4:: ;you have to press 1Joy7 first If !GetKeyState("1Joy7") Return send !{F5} Return ;Previous Disk 1Joy3:: ;you have to press 1Joy7 first If !GetKeyState("1Joy7") Return send !{F6} Return ;Swap ports 1Joy6:: ;you have to press 1Joy7 first If !GetKeyState("1Joy7") Return send !{F10} Return ;Exit 1Joy5:: ;you have to press 1Joy7 first If !GetKeyState("1Joy7") Return Run, X:\Emulation\LaunchBox\Nomousy\nomousy.exe send {alt down} send {F4} send {alt up} Return 2Joy8::Send {Space} 2Joy2::Send {Esc} 2Joy9::Send {n} 2Joy10::Send {y} ;Next Disk 2Joy4:: ;you have to press 2Joy7 first If !GetKeyState("2Joy7") Return send !{F5} Return ;Previous Disk 2Joy3:: ;you have to press 2Joy7 first If !GetKeyState("2Joy7") Return send !{F6} Return ;Swap ports 2Joy6:: ;you have to press 2Joy7 first If !GetKeyState("2Joy7") Return send !{F10} Return ;Exit 2Joy5:: ;you have to press 2Joy7 first If !GetKeyState("2Joy7") Return Run, X:\Emulation\LaunchBox\Nomousy\nomousy.exe send {alt down} send {F4} send {alt up} Return 3 1 Quote Link to comment Share on other sites More sharing options...
jayjay Posted November 3, 2017 Share Posted November 3, 2017 (edited) While we wait for the shutdown option to be enabled in BB menu with pin enabled Iv been using the following, loaded along side BB: Controller version: #SingleInstance Force Joy1:: if GetKeyState("Joy3") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy3:: if GetKeyState("Joy1") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy5:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy6") Goto, shut_down Return Joy6:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy5") Goto, shut_down Return shut_down: { SplashTextOn, 200, 50, Shut Down?, A - Confirm B - Cancel KeyWait, Joy1 Loop { Loop { If GetKeyState("joy1") { shutdown, 5 } else If GetKeyState("joy2") { SplashTextOff Return } } } } Return Keyboard version: #SingleInstance Force z:: if GetKeyState("x") if GetKeyState("c") Goto, shut_down Return x:: if GetKeyState("z") if GetKeyState("c") Goto, shut_down Return c:: if GetKeyState("z") if GetKeyState("x") Goto, shut_down Return shut_down: { SplashTextOn, 200, 50, Shut Down?, Enter - Confirm Esc - Cancel Loop { Loop { If GetKeyState("enter") { shutdown, 5 } else If GetKeyState("esc") { SplashTextOff Return } } } } Return Controller: Im using xbox 360 controller so pressing LB, RB, A, X together will bring up a splash box. Press A to shutdown or Press B to cancel. Keyboard: Press Z, X, C together. Splash box, Enter to shutdown, Esc to cancel. It will force close any open programs and shutdown. Edited November 3, 2017 by jayjay 1 Quote Link to comment Share on other sites More sharing options...
jayjay Posted November 3, 2017 Share Posted November 3, 2017 And just because: #SingleInstance Force Joy10:: Goto, B2 B2: { Keywait, Joy6, D T2 if ErrorLevel 0 { Return } Else Goto, B3 } B3: { Keywait, Joy1, D T2 if ErrorLevel 0 { Return } Else Goto, B4 } B4: { Keywait, Joy5, D T2 if ErrorLevel 0 { Return } Else Goto, B5 } B5: { Keywait, Joy7, D T2 if ErrorLevel 0 { Return } Else Goto, B6 } B6: { Keywait, Joy4, D T2 if ErrorLevel 0 { Return } Else Goto, B7 } B7: { Keywait, Joy2, D T2 if ErrorLevel 0 { Return } Else Goto, B8 } B8: { Keywait, Joy6, D T2 if ErrorLevel 0 { Return } Else Goto, B9 } B9: { Keywait, Joy1, D T2 if ErrorLevel 0 { Return } Else Goto, B10 } B10: { Keywait, Joy5, D T2 if ErrorLevel 0 { Return } Else Goto, shut_down } shut_down: { SplashTextOn, 200, 50, Shut Down?, A - Confirm B - Cancel KeyWait, Joy1 Loop { Loop { If GetKeyState("joy1") { shutdown, 5 } else If GetKeyState("joy2") { SplashTextOff Return } } } } return With this you would have to put in a button combo to shut down. Buttons have to be pressed within 2 seconds of each other or the script will reset. In this case "R3, R1, A, L1, Select, Y, B, R1, A, L1". Quote Link to comment Share on other sites More sharing options...
bnugget Posted November 10, 2017 Share Posted November 10, 2017 Is there a Hotkey for closing out of 4DO? Thanks. Quote Link to comment Share on other sites More sharing options...
jayjay Posted November 17, 2017 Share Posted November 17, 2017 Iv been Improving on AHK. Here's a better version of the shutdown above: Normal: #SingleInstance Force Joy1:: if GetKeyState("Joy3") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy3:: if GetKeyState("Joy1") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy5:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy6") Goto, shut_down Return Joy6:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy5") Goto, shut_down Return shut_down: { KeyWait, Joy1 Gui, -Caption +ToolWindow Gui, Margin, 0, 0 Gui, Add, Picture, , Shutdown.png Gui, Show Loop { Loop { If GetKeyState("joy1") { shutdown, 5 } else If GetKeyState("joy2") { Gui, Cancel Return } } } } Return With Transparency: #SingleInstance Force Joy1:: if GetKeyState("Joy3") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy3:: if GetKeyState("Joy1") if GetKeyState("Joy5") if GetKeyState("Joy6") Goto, shut_down Return Joy5:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy6") Goto, shut_down Return Joy6:: if GetKeyState("Joy1") if GetKeyState("Joy3") if GetKeyState("Joy5") Goto, shut_down Return shut_down: { KeyWait, Joy1 CustomColor = EEAA99 Gui, +LastFound +AlwaysOnTop -Caption +ToolWindow Gui, Color, %CustomColor% Gui, Add, Picture, ,Shutdown.png WinSet, TransColor, %CustomColor% Gui, Show Loop { Loop { If GetKeyState("joy1") { shutdown, 5 } else If GetKeyState("joy2") { Gui, Cancel Return } } } } Return Obviously my artwork could use some work. Its just a png. Name the png Shutdown.png and store it in the same directory as the script. 1 Quote Link to comment Share on other sites More sharing options...
Lordmonkus Posted December 22, 2017 Author Share Posted December 22, 2017 Control + F12 script for WinUAE or any other emulator that requires it. #NoEnv Sleep, 3000 SetKeyDelay, -1, 110 Send, ^{F12} Return 1 Quote Link to comment Share on other sites More sharing options...
Lordmonkus Posted January 24, 2018 Author Share Posted January 24, 2018 1 Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 3, 2018 Share Posted February 3, 2018 (edited) Does anyone know... You know how you can use a batch file to pass a rom on to an emulator, for instance... set batch file as an emulator. load game in LB. rom is passed to batch file which does some stuff. Then the rom is loaded with emulator. (Hope that makes sense) Does anyone know how to do this with ahk? Edit: Run retroarch.exe "%1%" "%2%" "%3%" Edited February 3, 2018 by jayjay Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 3, 2018 Share Posted February 3, 2018 I think when editing posts it should have the code <> option. Anyway display an image before launching retroarch. Controller image or whatever. Display image and wait for key press: SetWorkingDir T:\RetroArch\ ;change to retroarch directory Gui, -Caption +ToolWindow Gui, Margin, 0, 0 Gui, Add, Picture, , T:\Launchbox\Images\Controller\Snes Controller.png ;change to image path Gui, Show KeyWait, Joy1, d KeyWait, Joy1 ;change both joy1 to whatever you want Run, retroarch.exe "%1%" "%2%" "%3%" Sleep, 1000 Exitapp Display image for 10 seconds SetWorkingDir T:\RetroArch\ ;change to retroarch directory Gui, -Caption +ToolWindow Gui, Margin, 0, 0 Gui, Add, Picture, , T:\Launchbox\Images\Controller\Snes Controller.png ;change to image path Gui, Show Sleep 10000 ;change display time, 1000 = 1 sec Run, retroarch.exe "%1%" "%2%" "%3%" Sleep, 1000 Exitapp In the script change retroarch directory and image path. In launchbox add a new emulator for each system. Point the path to the script. Add the same settings as if you were adding retroarch. (-L "cores\bsnes_accuracy.dll" etc etc) Bulk edit roms and select your new emulator. 1 Quote Link to comment Share on other sites More sharing options...
JamesBond@ge Posted February 7, 2018 Share Posted February 7, 2018 (edited) On 2/3/2018 at 10:23 PM, jayjay said: Anyway display an image before launching retroarch. Controller image or whatever. I like this method you have going on here. Is it possible to use this method of yours with shortcuts (.lnk) Windows Games or whatever or (.url) for Steam games. I have lots of screenshots of Xpadder control layouts for my Windows / Steam / MS-DOS games because they are the platforms where the controls aren't standardized and I've made them up as I go along lol. So yeah, using your method to throw up one of my Xpadder screenshots before launching a Windows etc game would be great. (I'm not sure if it's possible though because Shortcuts are a different animal to emulators) Edited February 7, 2018 by JamesBond@ge 1 Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 7, 2018 Share Posted February 7, 2018 1 hour ago, JamesBond@ge said: snip I haven't started with dos games yet and prob not going to for a while yet. I dont know how they work. Still got so much other stuff to do. Had a pc melt down, so yeah, sucks... Iv never used steam so dont know how it works. Im guessing you just click a .url? If so its going to be like windows games. Gui, -Caption +ToolWindow Gui, Margin, 0, 0 Gui, Add, Picture, , T:\Launchbox\Images\Controller\Snes Controller.png ;change to image path Gui, Show KeyWait, Joy1, d KeyWait, Joy1 ;change both joy1 to whatever you want Run, path-to-game-exe-or-url-etc Sleep, 1000 Exitapp Change path to image and path-to-game-exe-or-url-etc. Then in LB you would have to change the path in the game launcher tab to the new script. But you would have to do 1 script per game. Depending on how many games you have, could be a bit of a mission. Might be worth waiting for jason to come up with something at some point. Quote Link to comment Share on other sites More sharing options...
jayjay Posted February 7, 2018 Share Posted February 7, 2018 (edited) Edit: Iv just tested the following: I import my windows games as roms. So under the games edit options there is the emulation tab. I dont know if you get that tab if games have been imported as windows games or steam games. But if it is there, you can bulk edit an emulator for windows games. Also just to note. In LB, in the edit options of a game. Whatever is in the path under the launcher tab can be passed to a script. As an example, my james bond blood stone path is e:\xbox 360 games\james bond blood stone\bond.exe. In a script, using the variable %1% will capture this path. So what you could do... hopefully I can explain this properly. Create a controller image named bond.png. (needs to be named the same as the .exe, so for me I would have bond.exe and bond.png) Create this script ImageDir = T:\Launchbox\Images\Controller ;directory with controller images Var1 = %1% SplitPath, Var1, , , , Filename IfExist, %ImageDir%\%Filename%.png { Gui, -Caption +ToolWindow Gui, Margin, 0, 0 Gui, Add, Picture, , %ImageDir%\%Filename%.png Gui, Show KeyWait, Joy1, d KeyWait, Joy1 ;change both joy1 to whatever you want Run, %1% Sleep, 1000 Exitapp } else { Run, %1% Exitapp } Bulk edit windows games to use this as an emulator. The idea is, it takes the .exe filename without the extension and looks in your image directory for a png with the same filename as the .exe. If your .exe has a funny name. You could create a shortcut. rename it whatever. Point LB launcher path to the shortcut and name the png the same as the shortcut. And again its prob best to wait for jason to do something lol. Edited February 7, 2018 by jayjay Quote Link to comment Share on other sites More sharing options...
zombie57 Posted February 18, 2018 Share Posted February 18, 2018 Hello ! Is there a script available to exit the Sega Model 2 emulator ? I would like to send ESC when I press the Switch View button on my XBOX one controller. Trying to get a keyboard free expereince here. Many thanks. Quote Link to comment Share on other sites More sharing options...
Charco Posted February 19, 2018 Share Posted February 19, 2018 Here's a script to launch Yatagarasu Attack on Cataclysm in full screen from the launcher: #SingleInstance force Loop while WinExist("YatagarasuLauncher") { Send, {Tab}{Enter} ExitApp } Just point LaunchBox to the launcher and this script should do the trick. Quote Link to comment Share on other sites More sharing options...
flatuswalrus Posted April 6, 2018 Share Posted April 6, 2018 Hi, I use the following to close MAME: $4:: { Process, Close, {{{StartupEXE}}} } I am wanting to add the option to close it via the home-button on the PS4 controller as well as the '4' on the keyboard. Would someone be so kind as to show me how? Thank you in advance. Quote Link to comment Share on other sites More sharing options...
Zombeaver Posted April 6, 2018 Share Posted April 6, 2018 45 minutes ago, Dane said: Hi, I use the following to close MAME: $4:: { Process, Close, {{{StartupEXE}}} } I am wanting to add the option to close it via the home-button on the PS4 controller as well as the '4' on the keyboard. Would someone be so kind as to show me how? Thank you in advance. You likely can't. AHK is very picky/finicky when it comes to joystick hotkeys. You can't assign the Xbox button on a 360/One controller in AHK (it doesn't recognize the input) so I would assume the same would be true for a PS4 controller. You can test by downloading the joystick test script here: https://autohotkey.com/docs/scripts/JoystickTest.htm Run the script with the controller connected and if it doesn't show a button name when you press the home button you won't be able to use it. If it does show a button name you'll just need to duplicate your script and use the button as the hotkey to trigger it. Something like 1Joy8:: followed by the close command. 1 Quote Link to comment Share on other sites More sharing options...
flatuswalrus Posted April 6, 2018 Share Posted April 6, 2018 6 minutes ago, Zombeaver said: You likely can't. AHK is very picky/finicky when it comes to joystick hotkeys. You can't assign the Xbox button on a 360/One controller in AHK (it doesn't recognize the input) so I would assume the same would be true for a PS4 controller. You can test by downloading the joystick test script here: https://autohotkey.com/docs/scripts/JoystickTest.htm Run the script with the controller connected and if it doesn't show a button name when you press the home button you won't be able to use it. If it does show a button name you'll just need to duplicate your script and use the button as the hotkey to trigger it. Something like 1Joy8:: followed by the close command. Thanks very much. I will look into that. If I want to have two different options (buttons) to close something do I just separate them by a comma such as: $4,3:: { Process, Close, {{{StartupEXE}}} } ? Quote Link to comment Share on other sites More sharing options...
Zombeaver Posted April 6, 2018 Share Posted April 6, 2018 No, you'd make them separate lines, like $4:: { Process, Close, {{{StartupEXE}}} } $3:: { Process, Close, {{{StartupEXE}}} } Scroll up to my CCS64 script above if you want a more complex example. 1 Quote Link to comment Share on other sites More sharing options...
jayjay Posted April 6, 2018 Share Posted April 6, 2018 6 hours ago, Zombeaver said: You can't assign the Xbox button on a 360/One controller in AHK. Xbox 360 home button is vk07sc000 in ahk. Im lead to believe its also the same for XB1 controller. But haven't tested myself... If the first script that @Zombeaver posted doesnt show anything try key history. #InstallKeybdHook esc:: keyhistory return run the script press home button a few times press escape track down the button press on the screen that pops up. Other than that I cant help. Dont have time to play with ahk any more. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.