Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

10 hours ago, JoeViking245 said:

 

Change the "Y" (wye) to a "v" and always use lowercase letters.


Send, ^!v

And make sure the always-running script is using lowercase as well.

Hmm, it isn't working for me, this was one of the first methods I tried.... The part ofr me that you quoted is for a different launcher I am wanting to achieve the same results with. I have 2, ctrl+alt+y and ctrl+alt+v, I just copied the wrong one. 

Thanks again for your priceless knowledge

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

I have different playlists but I want all games to show upon launch but it remembers the last one I was on. So I'm trying to make a script but it's not working.

This didn't work

Sleep 1000
run, Launchbox.exe

Send {Tab Down} {Tab Up} {Tab Down} {Tab Up} {Tab Down} {Tab Up} {Tab Down} {Tab Up}
Sleep 100 
Send {Home Down} {Home Up}
Sleep 100 
Send {Tab Down} {Tab Up}

But if I launch Launchbox and hit tab 4 times and then home key it will go up to the all category. I just need a script to do the tab tab tab tab home for me. 

 

Also tried


Sleep 1000
run, Launchbox.exe

Send {Tab Down} 
Sleep 100 
Send {Tab Up} 
Sleep 100 
Send {Tab Down} 
Sleep 100 
Send {Tab Up}
Sleep 100 
Send {Tab Down}
Sleep 100 
Send {Tab Up}
Sleep 100 
Send {Tab Down}
Sleep 100 
Send {Tab Up}
Sleep 100
Send {Home Down}
Sleep 100
Send {Home Up} 

And

Send {Tab 4}
Sleep 100
Send {Home}

 

Either I'm doing it wrong or maybe scripts like that are disabled in Launchbox window? I don't have premium either. 

Edited by Jayinem
Link to comment
Share on other sites

16 hours ago, Jayinem said:

This didn't work

Add a Sleep timer after "Run, LaunchBox.exe" so it has time to fully load.  May also want (need?) to add SetKeyDelay at the beginning.  Maybe something like:

SetKeyDelay, 0, 50
Run, LaunchBox.exe
Sleep, 5000
Send {Tab 4}
Send {Home}

You can adjust the Sleep timer based on how quickly LB loads up for you.

Link to comment
Share on other sites

29 minutes ago, JoeViking245 said:

Add a Sleep timer after "Run, LaunchBox.exe" so it has time to fully load.  May also want (need?) to add SetKeyDelay at the beginning.  Maybe something like:


SetKeyDelay, 0, 50
Run, LaunchBox.exe
Sleep, 5000
Send {Tab 4}
Send {Home}

You can adjust the Sleep timer based on how quickly LB loads up for you.

Thanks but it just doesn't seem to do anything. There's this racing game that you have go into settings and disable msaa everytime you launch it, and I was able to make a script and I see it automatically navigate the menus by itself and turn it off for me which is pretty cool. But no matter what I try even your script there's no change. If I hit tab tab tab tab and then home myself it will always go show all, but it seems maybe ahk is disabled for navigating menus? Not sure. 

Link to comment
Share on other sites

Wait I just tried it again and it did it! I think it has to do with if you have something selected or not. If you just have Launchbox open with nothing selected it won't work, but if you have one of the playlists selected it will do it. It's the same as if you try to hit tab tab tab tab home with or without something selected first, without anything being selected it won't do anything. Not sure if there's a way to force it to select an item in the script but still pretty cool, thanks for the script. 

Edited by Jayinem
Link to comment
Share on other sites

Got one more question about a script hope you don't mind.  I'm into a game Persona Strikers, but I close my internet browser chrome when I run it because it seems to slow it down (probably because I have like 20 pinned web sites) I got the script down to close chrome when running the game and it does, but I want to reopen chrome when I exit the game.

The game let's you close with alt+f4, but I tried scripts to change it to escape but nothing worked. Maybe the game doesn't let you alter keyboard keys not sure.  But I would need something that tells chrome to reopen when hitting alt+f4, or when closing game.exe. I tried IfWinNotActive but it didn't work, but maybe I did it incorrectly. 

 

 

Edited by Jayinem
Link to comment
Share on other sites

19 minutes ago, Jayinem said:

I want to reopen chrome when I exit the game.

Depending on how you launch the game will determine where to place [something like] this.  

WinClose, ahk_exe Chrome.exe                    ;optional
Process, Wait, PersonaStrikers.exe              ;Wait for the game to be running
Sleep 1000                                      ;Once running, wait 1 more second to be sure
while winExist("ahk_exe PersonaStrikers.exe")   ;While the game is still running
  sleep 700                                     ;   Hang out here, but check again
Run, chrome.exe                                 ;The game's not running anymore, so start Chrome again.

If it's just the 1 game, you can set it to Run this script Before Main Application

Link to comment
Share on other sites

1 hour ago, JoeViking245 said:

Depending on how you launch the game will determine where to place [something like] this.  





WinClose, ahk_exe Chrome.exe                    ;optional
Process, Wait, PersonaStrikers.exe              ;Wait for the game to be running
Sleep 1000                                      ;Once running, wait 1 more second to be sure
while winExist("ahk_exe PersonaStrikers.exe")   ;While the game is still running
  sleep 700                                     ;   Hang out here, but check again
Run, chrome.exe                                 ;The game's not running anymore, so start Chrome again.

If it's just the 1 game, you can set it to Run this script Before Main Application

You're good at ahk. It worked, but it kind of has a strange behavior it doesn't go straight to the game the game blinks for a second then minimizes and then it goes to another tab in chrome.  But when I close the game it does run chrome. Just wonder if I could have the game maximized when clicking on it. 

As far as how I launch the game, I just put run,  game.exe before this. Is that wrong? 

 

And sorry but I get confused like when you post ("ahk_exe PersonaStrikers.exe") is than an example that needs to be changed or do I leave it? If I need to change it, would I change it to ahk_exe game.exe or just game.exe?  game.exe is the actual .exe that Persona Strikers is called btw. 

Edited by Jayinem
Link to comment
Share on other sites

Thank you!

9 minutes ago, Jayinem said:

As far as how I launch the game, I just put run,  game.exe before this. Is that wrong? 

Script aside, how are you currently launching the game?  Can you share a snapshot of your Launching 'tab' and one of your Emulator 'tab' (if applicable) for this particular game?

Link to comment
Share on other sites

3 minutes ago, JoeViking245 said:

Thank you!

Script aside, how are you currently launching the game?  Can you share a snapshot of your Launching 'tab' and one of your Emulator 'tab' (if applicable) for this particular game?

Actually I'm running it through the script itself. It's a pc game so no emulator needed. I just add run, game.exe before your script and I thought I had added an additional app to close chrome but I didn't and I wiped out my script and used yours, and I don't remember how I closed chrome exactly so I added this line Winclose ahk_exe chrome.exe, but overall it's not working. Here is my entire script I am running copied exactly.  But it's not closing chrome and just opening an additional chrome window that's blank.  Well your part is reopening chrome is working, but it's not closing chrome anymore in the first place. 

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance Force


run, game.exe
Sleep 10000
Winclose ahk_exe chrome.exe 

Process, Wait, game.exe              ;Wait for the game to be running
Sleep 1000                                      ;Once running, wait 1 more second to be sure
while winExist("ahk_exe game.exe")          ;While the game is still running
  sleep 700                                     ;   Hang out here, but check again
Run, chrome.exe                                 ;The game's not running anymore, so start Chrome again.

 

Edited by Jayinem
Link to comment
Share on other sites

I got it, I know I didn't probably have to do this, but I don't care about sloppiness when it comes to ahk just want scripts to work. So I made a close chrome script and reopen chrome script and added them both to launchbox and just run the game.exe normally through launchbox.

close chrome

IfWinExist, ahk_exe chrome.exe
WinClose 

reopen chrome after closing game

Process, Wait, game.exe              ;Wait for the game to be running
Sleep 1000                                      ;Once running, wait 1 more second to be sure
while winExist("ahk_exe game.exe")   ;While the game is still running
  sleep 700                                     ;   Hang out here, but check again
Run, chrome.exe            

Thanks for your help. 

  • Game On 1
Link to comment
Share on other sites

Ended up needing 1 more but it's not about Launchbox or a game, it's about chrome tabs. I have about 20 pinned tabs that start with windows that way and any time I launch chrome. Sort of similarly to how I wanted all games showing in launchbox, I would like the main page to show when I start chrome or if possible, after a certain amount of time. So like if i had launchbox.com on a tab, but then I go into the forums or whatever other page, I would want it to go back to launchbox.com for example.  To make things a bit more complicated I read that chrome uses ctrl+1 through ctrl+8 as tab shortcuts but I already use those for other ahk scripts. I can change them if necessary, but I would prefer to change the chrome hotkeys because I'm so used to them. Appreciate it again I know this might be kind of a doozy.  I promise this'll be the last one not going to keep coming up with more and more, but even if you don't or can't help I won't be upset still appreciate the help you already provided.

Edited by Jayinem
Link to comment
Share on other sites

1 hour ago, Jayinem said:

I have about 20 pinned tabs that start with windows

When you 're-open' Chrome, couldn't you just send the same command that Windows sends when you start it?

1 hour ago, Jayinem said:

I read that chrome uses ctrl+1 through ctrl+8 as tab shortcuts but I already use those for other ahk scripts.

Tech tip: Windows does the same thing but with the Windows key for your pinned taskbar items (win+1, win+2...).  No idea how to reassign the ones for Chrome.  Probably just do a search for it.  (hint: search for something like 'customize Chrome keyboard shortcuts').

Link to comment
Share on other sites

15 minutes ago, JoeViking245 said:

When you 're-open' Chrome, couldn't you just send the same command that Windows sends when you start it?

I don't know what you mean, sorry.  I'm wanting it to have a default page for each tab so if I change them it changes it back to the default page. 

Edited by Jayinem
Link to comment
Share on other sites

Ok so this may not be helpful to everyone, but I kept having Launchbox closed because I had a super escape key that I combined escape and alt+f4, and I would escape games and it would close Launchbox, so this constantly checks if Launchbox is open and if it's not it opens it, but if it's open it does nothing.  Change my path to my Launchbox to your own and throw it in startup and you have a guaranteed always running Launchbox the entire time your computer runs, and the first part makes sure all your games show in playlist instead of a different playlist, but if you want you can remove that. 

#SingleInstance, force

Sleep 8000
SetKeyDelay, 0, 50
Run, LaunchBox.exe
Sleep, 10000
Send {Tab 4}
Send {Home}



Loop
{
Sleep 3900 ;
Process, Exist, Launchbox.exe
If (ErrorLevel = 0)
 {
  Run, D:\Jayinem\LaunchBox\Launchbox.exe
 }
 Else
 {
 Sleep 5
 }
}
Return

 

Edited by Jayinem
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...