Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

  • 3 weeks later...

Guys, MUGEN exits with f3, how do I add that into the script below that exits when i hold start+select on my controller?

Joy8::
If GetKeyState("Joy9")
{
   SetKeyDelay, -1, 110
   WinClose, ahk_exe {{{StartupEXE}}}
}
Return

Cheers!

Edited by mentazm
Link to comment
Share on other sites

On 1/29/2020 at 8:39 PM, Lordmonkus said:

Mess / Mame doesn't require a script, just set it in the mame.ini or through command line.

screenshot_653.jpg.9ff893e94bb458e099a3eb7c5cd9dce5.jpgwindow    0 in the mame.ini

or 

-nowindow

command line parameter should work.

@Lordmonkus I'm trying to run MESSUI and I tried the default command line -nowindow and it doesn't work. Also tried changing the MESS_g.ini file, it was set to 0 already.  I have another version of MESS without the UI and it opens in full screen no problem.  Any ideas on how to get the MESSUI to open in full screen?

Edited by edgecrusher462
Link to comment
Share on other sites

  • 2 weeks later...
$Esc::
{
    Process, Close, {{{StartupEXE}}}
} 

with this script I can close Yuzu emulator. How can I make it so I can close with a Xbox controller? Lets say holding down back.

i tried automation closing active window and setting keys all it does it prompt if want to close Yuzu.

Edited by HyperSpinEmu
Link to comment
Share on other sites

On 2/11/2020 at 9:18 PM, HyperSpinEmu said:

$Esc::
{
    Process, Close, {{{StartupEXE}}}
} 

with this script I can close Yuzu emulator. How can I make it so I can close with a Xbox controller? Lets say holding down back.

i tried automation closing active window and setting keys all it does it prompt if want to close Yuzu.

There should be an option inside the actual Yuzu emulator to turn off "confirm exit".

Edited by JamesBond@ge
Link to comment
Share on other sites

  • 4 weeks later...

Hey guys, this isn't game related however it is AHK and BB related. I've been to the AHK forum, but none have answered and it has been up for nearly a week. You'll find I have uploaded the cursor image, the .bat and the .exe launcher that this script calls for with the hotkeys in my script. This launcher is a pc "game" I've added to BB. 

So, I have a script I am trying to sort out that will launch a small app that opens YouTubeKids ub Chrome, that is sorted out. I want it to change the main cursor as well as the link select cursor. I have successfully gotten it to change the main cursor, yet no matter what I do, I cannot get it to change the link select cursor. I am lost. So thats why I have turned to this awesome community. Here is my script so far:

 

^!Y::
Run "E:\Downloads\kodi shit\Windows Shortcuts and roms\YT Kids\YouTube Kids.exe"

 Cursor = %A_ScriptDir%\ytk.cur
    CursorHandle := DllCall( "LoadCursorFromFile", Str,Cursor )

    ; change cursor size
    IMAGE_BITMAP := 0x0
    IMAGE_CURSOR := 0x2
    IMAGE_ICON := 0x1

    ; size
    cx := 48, cy := cx

    ; fuFlags
    LR_COPYFROMRESOURCE := 0x4000

    CursorHandle := DllCall( "CopyImage", uint,CursorHandle, uint,IMAGE_CURSOR, int,cx, int,cy, uint,0 )

    ; replace cursor
    Cursors = 32512,32513,32514,32515,32516,32640,32641,32642
             ,32643,32644,32645,32646,32648,32649,32650,32651
    Loop, Parse, Cursors, `,
        DllCall( "SetSystemCursor", Uint,CursorHandle, Int,A_Loopfield )

return

+Escape::
	send ^w
	sleep, 120
    SPI_SETCURSORS := 0x57
    DllCall( "SystemParametersInfo", UInt,SPI_SETCURSORS, UInt,0, UInt,0, UInt,0 )

return

 

 

YT Kids.zip

Edited by CtinD
Link to comment
Share on other sites

Have you tried asking on Stack Overflow? ;) 

By "YouTubeKids hotkeys" I'm assuming {Ctrl}{Alt}Y.  And is it safe to assume that the exe file is what opens chrome? ('cause I ain't checkin')

To combine the two, hmmm......  how about have the "mouse script" be a function inside the 1st script?  Then when ^!Y is pressed, it does its' thing and also [have it] call mouseScript().  Though not sure how that works with the #Directives.  But if you can work that out, inside CheckChrome:  add in a check for {Shift}{Esc} and Return will (should?) close the function.  Or Exit.  But not ExitApp.   I think..lol

If (GetKeyState("Shift", "P") && GetKeyState("Escape", "P"))
	Return

(...may need to put it in a Loop.) 

Plan B: is in the the ^!Y script, have it also 'Run' your Mouse_Script.ahk (or compile it to exe) and in the {Shif}{Escape} sequence add in

DetectHiddenWindows, On 
WinClose,  ahk_class AutoHotkey

 

 

Link to comment
Share on other sites

10 hours ago, JoeViking245 said:

Have you tried asking on Stack Overflow? ;) 

By "YouTubeKids hotkeys" I'm assuming {Ctrl}{Alt}Y.  And is it safe to assume that the exe file is what opens chrome? ('cause I ain't checkin')

To combine the two, hmmm......  how about have the "mouse script" be a function inside the 1st script?  Then when ^!Y is pressed, it does its' thing and also [have it] call mouseScript().  Though not sure how that works with the #Directives.  But if you can work that out, inside CheckChrome:  add in a check for {Shift}{Esc} and Return will (should?) close the function.  Or Exit.  But not ExitApp.   I think..lol


If (GetKeyState("Shift", "P") && GetKeyState("Escape", "P"))
	Return

(...may need to put it in a Loop.) 

Plan B: is in the the ^!Y script, have it also 'Run' your Mouse_Script.ahk (or compile it to exe) and in the {Shif}{Escape} sequence add in


DetectHiddenWindows, On 
WinClose,  ahk_class AutoHotkey

 

 

Hey @JoeViking245, thanks for responding so quickly! I appreciate your input and help. When I get a chance, I'll post on stack overflow. I appreciate that tip as it never even crossed my mind ??. Still, any additional input you may have, I'm all ears and will gladly give it a try. I'm sorry for the delayed response, I am a VERY busy full-time single father to 2 youngins (both 6 years old and only 10 months apart ?) and a full-time caregiver to my disabled vet senior father. That doesn't allot me much 'me' time during the day to go and check the forums and play around with my precious project. No complaints. It is what it is. ?

So, I managed to (partially) sort this out using method 2, the quick'n'dirty method. Which somewhat works like RocketLauncher. My hotkey launches the exe (which is just a bat file with a chrome shortcut opening YouTubeKids.com in kiosk mode converted to exe) which is an invisible command window (I can't stand to see a window popup for even a second, it takes away from the 'appliance' experience), and the accept which has been compiled to an exe. When I send shift escape, it closes the tab, waits then closes the process for that compiled mouse script. All of that works fine. This also has allowed me to remap keys on my remote for page navigation and convert directional arrows to mouse movement. 

 

What's bugging the heck out of me is that only the system cursor changes to my custom cursor file. I also want the link hand to change and be resizeable, so it will be larger than what I have set for the system cursor. This is for the kids, so I want it fun and engaging to them. I know this is a long shot, but I'd also like it to play a click sound mp3 with any kind of page navigation, ie: clicking the link or going back. I've tried copying the entrity of the mouse script and changing a few lines so that it points to the link cursor (idc_hand is what it's called, I believe) but it seems to just cancel it out all together. 

 I'm telling ya, if I scratched my head anymore on this, I'd have a bald spot. Lol

P.S. Sorry for the novel. I don't get much people interaction. Lol

P.P.S. if you are running an HTPC, I figured out how to get YouTube on TV working on chrome. If you like, I'll send you the link to my write-up on Kodi's forum. Anyone for that matter actually. My next step is figuring out how to replace the key prompts to reflect the remote rather than keyboard keys. Should be as simple as finding the temporary files and replacing the PNGs with my custom ones. 

Edited by CtinD
Added additional chapters
Link to comment
Share on other sites

Glad to hear that worked out! ?

Ya, No HTPC here.  But I do have my arcade cab hooked to my TV for playing [Steam] Lego Harry Potter on "the big screen" with the XBox 360 controller while sitting comfortably on the couch. ?

How about having a 2nd 'custom' installation of Chrome just for the Kids?  A quick search for "change cursor in chrome" and also "have a mouse click sound in chrome" yielded some possibilities.   Or I'm sure there's some way programmatically to start it with these options.

  • Thanks 1
Link to comment
Share on other sites

9 hours ago, JoeViking245 said:

Glad to hear that worked out! ?

Ya, No HTPC here.  But I do have my arcade cab hooked to my TV for playing [Steam] Lego Harry Potter on "the big screen" with the XBox 360 controller while sitting comfortably on the couch. ?

How about having a 2nd 'custom' installation of Chrome just for the Kids?  A quick search for "change cursor in chrome" and also "have a mouse click sound in chrome" yielded some possibilities.   Or I'm sure there's some way programmatically to start it with these options.

So, you and I are on the same page. with many things here. I actually am running a portable install of chrome for YouTubeKids, and Youtube on tv. That is why I have these little launchers. It launches in kisok mode, and the youtube on tv launcher uses a Samsung Smart Tv user agent string. Speaking of, I am trying to figure out how to do the same for spotify on the smart tv's. All of those apps are just a web browser wrapped 'app'. That's how youtube on tv works. I just cant figure out what web addy spotify uses for the app. Anyhow, I am getting off topic. So your suggestions for the mouse click sounds gave me an idea. Last night i figured out how to add SMS style input (tapping the numbers to cycle through each letter to spell a word) to my remote using AHK and I wanted and audible click for each button press. So I did some searching and found how to make it play an audio file with each tap. I imagine that it will be on the same lines as this for my mouse click. So, that is sorted. I still can't figure out how to change the link hand. The main reason why I want to achieve this through AHK is the abilityt to make the cursor much bigger than what the system does. 

 

While I am here, do you know how I would use ahk to send an input after holding a key down? So i told you how i setup the number pad on my remote to cycle through the letters, it does that perfect, yet it will not do the numbers. SO in my mind, a good work around is long pressing it to send the number, just like the old flip phones. I know I am reaching with some of the things Im asking for help with. I am starting to get better at scripting. I just havent made that pay grade yet. lol

Link to comment
Share on other sites

10 hours ago, JoeViking245 said:

AHK is pretty slick and can actually do quite a bit.  Even as far a being able to create your own gui program.  Then maybe someday we can even graduate you up to C# :) 

For a long press, you'll want to look at KeyWait with a Timeout option.  https://www.autohotkey.com/boards/viewtopic.php?t=10067

I agree wholeheartedly, AHK is amazing. It is so robust in what it can accomplish. I love that if it is limited in some way, someone can create their own library and give it additional functionality. I have been thinking about "graduating" as well. I have been using ahk since hyperspin and hyperlaunch 1.0 days. I considered myself to be ok back then. Only using it for hyperspin, limited my scope of knowledge though. Now I am trying to automate many functions through keypresses and find myself becoming better than "ok".  I believe before graduating to C#, I should try my hand at .vbs (not sure what it's actual name is). I have a feeling that doing this will greatly expand my knowledge and what my HTPC can accomplish. Then try C#. Thanks for the link. Checking it out right now. :) 

Are you on Facebook? I would like to connect, if you're ok with that.

Link to comment
Share on other sites

  • 3 weeks later...

Hi,

 

Do BB starts the script AHK before to begin an emulator.exe?

Then if it is right, is it possible for demul:

- to test a name of a rom

- and then start demun.exe

The idea is:

If rom=crazytaxi.zip then paddemul.ini=paddriving.ini

else paddemul.ini=pad.ini

end if

run demul.exe

 

Thanks.

Link to comment
Share on other sites

Could use some help exiting supermodel with autohotkey, I have copied the scripts found here and modified the keys for my own system but they do not work, I am using a pc build with a iPac pro and would like to use keys 1 and 2, my player buttons to exit the emulator. 
 

no matter what I change in the autohotkey window in LaunchBox, it still only exits when pressing esc button. Please help, I don’t understand what I’m doing wrong! 
 

thank you! 

Link to comment
Share on other sites

11 minutes ago, Visivopro said:

Could use some help exiting supermodel with autohotkey, I have copied the scripts found here and modified the keys for my own system but they do not work, I am using a pc build with a iPac pro and would like to use keys 1 and 2, my player buttons to exit the emulator. 
 

no matter what I change in the autohotkey window in LaunchBox, it still only exits when pressing esc button. Please help, I don’t understand what I’m doing wrong! 
 

thank you! 

What does the script look like you are using and what tab are you putting it in (Running AHK or Exit AHK)?

 

Link to comment
Share on other sites

9 minutes ago, Retro808 said:

What does the script look like you are using and what tab are you putting it in (Running AHK or Exit AHK)?

 

~4 & 2::

Duration=0

Loop

{	Duration ++

	If !GetKeyState("4","P") || !GetKeyState("2","P")

		Break

	If Duration > 2

	{	

        Process, Close, {{{StartupEXE}}}

		break

	}

	Sleep, 1000

}

return

 

I have changed the 4 to a 1 so it should exit when pressing player 1 and 2 together but it does nothing. thanks for the replay. im putting it in the exit hot key

Edited by Visivopro
Link to comment
Share on other sites

27 minutes ago, Retro808 said:

What does the script look like you are using and what tab are you putting it in (Running AHK or Exit AHK)?

 

never mind uuhhg I figured it out, I haden't changed the startupexe to the name of the supermodel exe thank you for helping though.

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...