Jump to content
LaunchBox Community Forums

Auto Hotkey Scripts


Lordmonkus

Recommended Posts

I have a question is there any script or any way to hide the loading screen that says loading games etc...? I have tried WinHide even by using WindowSpy and using the ahk_class in a script but it doesn't seem to work, but I'm hardly a AHK expert.

Now with running the script I posted on the previous post making Launchbox Windowed fullscreen, it's making the loading screen Windowed fullscreen as well and it looks terrible.

 

 

Edited by Jayinem
Link to comment
Share on other sites

I had to make a modification to the script I posted on the last page because it kept forcing Launchbox to be fullscreen even when I would try to minimize it. Now with this script it doesn't do that.

 

#SingleInstance force
#Persistent

Loop
{
      WinWaitActive, ("ahk_exe LaunchBox.exe")
      Sleep 5500
      WinMaximize
}

Also here's two more scripts you can add to Additional Apps for perhaps a game that is intense for your PC thus you need to close your browser which takes additional ram/resources away from your game. If you already have the best PC that can play the newest game at 4K 120 fps while having 20 browser windows open this won't apply to you. I use Firefox but if you use another browser just change it to the browser and the location of the browser.

Add this one to close Firefox upon launch of game

Sleep 3500
run, taskkill /F /IM firefox.exe /T

Name it whatever you want I call it Kill Firefox, and check the box that says "run before main application"

And then add this one I call it restart firefox and check the box that says "run after main application" This will automatically start Firefox again once the game closes as long as you close the game with escape key.

#NoTrayIcon
Run, "C:\Program Files\Mozilla Firefox\firefox.exe"

WinActivate ahk_class MozillaWindowClass

startProgram(winTitle, filePath) {
 If !WinExist(winTitle)
  Run % filePath
 WinWait % winTitle,, 5
 If ErrorLevel
  MsgBox 48, Error, An error occurred while waiting for the window.
 Else WinActivate
}

 

 

 

 

 

Edited by Jayinem
Link to comment
Share on other sites

I'm having trouble getting Saturn emulator SSF to start fullscreen it's just a badly programmed emulator. I even googled where someone said add fullscreen="1" to SSF.ini and it didn't help. So next thing I tried was adding Alt enter to Launchbox I put a sleep of 9000 because it takes a few seconds to load the game and then send !{enter} and I tried send !Enter neither did anything? I even tried Send {Alt down}{Enter}{Alt Up} but nothing. If I hit Alt Enter on the keyboard together it works.

Is it possible an app won't respond to autohotkey scripts? There's even an option to change what makes the emulator full screen I tried a number I tried a letter I put those in the script SSF will not do anything.

Nevermind found this on this forum from a few years ago, only thing that worked.

Sleep, 2500
 SetKeyDelay, -1, 110
 Send !{Enter}
 Return

Edited by Jayinem
Link to comment
Share on other sites

  • 2 weeks later...

I was going to make a video to really do it justice but had trouble with Microsoft's recording lasting longer than 5 seconds, but essentially my Launchbox is desktop wallpaper now. With an AHK script I can't change Launchbox to anything but Windowed fullscreen, however I can put apps like Firefox over it or minimize it if I want. I also have a script running with a loop that if Launchbox gets closed it reopens automatically in seconds and it's in startup shortcuts so it starts at launch.

 

 

Untitled.png

Edited by Jayinem
Link to comment
Share on other sites

Does anyone use Parsec? i am trying everything to get it to either start minimized or start as tray icon. I've tried adding -min to the shortcut I've tried ahk scripts WinMinimize etc... nothing works. Also there's no documentation on their website talking about command prompts to do it. Every other app I've tried I can figure out something but not this one.

Edited by Jayinem
Link to comment
Share on other sites

8 hours ago, Jayinem said:

Does anyone use Parsec? i am trying everything to get it to either start minimized or start as tray icon. I've tried adding -min to the shortcut I've tried ahk scripts WinMinimize etc... nothing works. Also there's no documentation on their website talking about command prompts to do it. Every other app I've tried I can figure out something but not this one.

I have a hyper-v virtual machine with video card sharing on a remote computer on which I use parsec and connect to daily.... Honestly I have never had to change anything, every night the machine reboots automatically via a BigBox plugin and parsec starts minimized in the systray without disturbing, are you sure you didn't use a portable version? Try reinstalling it in the default folder and use the “RUN WHEN MY COMPUTER STARTS” option.

Link to comment
Share on other sites

On 10/4/2024 at 3:15 AM, Sbaby said:

I have a hyper-v virtual machine with video card sharing on a remote computer on which I use parsec and connect to daily.... Honestly I have never had to change anything, every night the machine reboots automatically via a BigBox plugin and parsec starts minimized in the systray without disturbing, are you sure you didn't use a portable version? Try reinstalling it in the default folder and use the “RUN WHEN MY COMPUTER STARTS” option.

I don't even remember what I did but it works now thanks.

 

Edited by Jayinem
Link to comment
Share on other sites

I recommend downloading JoytoKey it makes gaming live (especially emulators) easier because you can map keys to controller combinations. I am using Wii U Pro through Mayflash and I didn't think the home button ever worked but just found out it did. I just mapped every button on my controller to do something in combination with my home button, including one to WinActivate Launchbox from a minimized state. So first you map an ahk script to a key or combo of keys, I have alt + L !l:: WinActivate ahk_exe Launchbox.exe. Then go into JoytoKey map a combination of buttons to be those combinations of keys. I mapped Select + Home to WinActivating Launchbox. And here are some my others. Since different emulators have different keys to go fullscreen I mapped 3 different button combos to fullscreen. Having all of these functions in combination of Launchbox allowing you to use your controller on the Launchbox menu makes it almost like having a game console.

Home + L2 = Escape Game
Home + R1 = Fullscreen (F11)
Home + L1 = Fullscreen (Alt+Enter)
Home + R2 = Fullscreen (F)
Home + Y = Save
Home + X = Load
Home + B = Save (Retroarch)
Home + A = Load (Retroarch)
Home + Left d-pad = Chiaki GUI 2nd screen
Home + Right d-pad = Chiaki Stream 2nd screen  
Home + Down d-pad = Chiaki Touchpad (for PS4 or PS5)
Home + Up d-pad = Citra swap screen
Home + Select = Launch Launchbox

If anyone needs any help using JoytoKey because it's a little difficult understand mapping combination of buttons at first just ask on this thread. It is possible to even map your mouse to your gamepad to where you can use it at any time on your computer, but I'm not much of a fan of that a mouse is just easier most of the time.

https://joytokey.net/en/download

p.s. it is totally also possible to do all of these functions with AutoHotkey if you prefer, I just prefer JoytoKey when it comes to controller.

Edited by Jayinem
Link to comment
Share on other sites

On 10/4/2024 at 3:15 AM, Sbaby said:

I have a hyper-v virtual machine with video card sharing on a remote computer on which I use parsec and connect to daily.... Honestly I have never had to change anything, every night the machine reboots automatically via a BigBox plugin and parsec starts minimized in the systray without disturbing, are you sure you didn't use a portable version? Try reinstalling it in the default folder and use the “RUN WHEN MY COMPUTER STARTS” option.

Can you try to run any ahk script on the Parsec GUI? I can't get any to work. I have F12 to change monitors because I have a gaming laptop that hooks up to my TV and I use extended desktop, it works on every app but Parsec and I use DisplayFusion and there's a little button on just about every app I can click with a mouse to change apps, not on Parsec. I'm sort of wondering if they found a way to disable all outside scripting? Unless it's just a problem on my end. I tried reinstalling Parsec it did not help.

I just tried a portable version the opposite of what you said earlier because I do have it installed to C:\username\Program Files and it does work to change screens, but not the installed version? weird. It says there's no hosting on portable version though.

Edited by Jayinem
Link to comment
Share on other sites

6 hours ago, Jayinem said:

Can you try to run any ahk script on the Parsec GUI? I can't get any to work. I have F12 to change monitors because I have a gaming laptop that hooks up to my TV and I use extended desktop, it works on every app but Parsec and I use DisplayFusion and there's a little button on just about every app I can click with a mouse to change apps, not on Parsec. I'm sort of wondering if they found a way to disable all outside scripting? Unless it's just a problem on my end. I tried reinstalling Parsec it did not help.

I just tried a portable version the opposite of what you said earlier because I do have it installed to C:\username\Program Files and it does work to change screens, but not the installed version? weird. It says there's no hosting on portable version though.

I’ve never encountered the issue you're describing. My only suggestion is to try running the AHK script as an administrator. If this works, it's likely a permissions issue, and you can then figure out how to address it accordingly.

Link to comment
Share on other sites

After reading, the reason you're able to get it working and I'm not is because you're using a Virtual Box which is essentially a different app. If you tried Parsec as a standalone you'd have the same issues. The installer version does not work with AHK, I'm having a little bit of success with the portable version but still having a few issues.

Link to comment
Share on other sites

2 hours ago, Jayinem said:

After reading, the reason you're able to get it working and I'm not is because you're using a Virtual Box which is essentially a different app. If you tried Parsec as a standalone you'd have the same issues. The installer version does not work with AHK, I'm having a little bit of success with the portable version but still having a few issues.

 

I don't use VirtualBox, so I'm not sure where you got that information. I use both the standalone and portable versions of Parsec on Windows 11 to connect to various machines, including both physical and virtual computers. I also use it on Android to connect to any computer. I had simply mentioned one of my more complex setups to show that Parsec works even in those cases, but in reality, I use it on several machines. As far as I'm concerned, Parsec works perfectly on all devices, so I'm not sure what issue you're facing. It works perfectly for me

Link to comment
Share on other sites

You said hyper-r virtual machine, I don't know much about those I thought that was a virtual box.

Just because it works perfectly and it runs at startup doesn't really answer my issue though. Have you ran specific scripts such as changing a monitor escaping from the gui, winmaximizing parsec? And I mean the GUI before it's connecting to another computer. I got it to winmaximize on the portable version, but it wouldn't change monitors. I use the same script on half a dozen other programs to change monitors on Windows 10 as I have my laptop hooked up to my TV and use extended desktop. Sometimes I'll be watching TV and want to use my laptop monitor to do various things without changing display types or without having to switch back to the TV so this script brings the apps from the main display (my TV) to my secondary display my laptop monitor, but it doesn't work for Parsec. It is the only program that it does not work.

Edited by Jayinem
Link to comment
Share on other sites

I figured out the solution to running scripts on Parsec GUI is to add run as admin in the script. Now I can move it activate maximize it.

 

SetTitleMatchMode 2
if not A_IsAdmin

  Run *RunAs "%A_ScriptFullPath%"
HotKey, NumpadDot, LaunchUpdate
return

SetWorkingDir, "C:\Program Files\Parsec"
LaunchUpdate:
               If WinExist("ahk_exe Parsecd.exe"){
  WinActivate ahk_exe Parsecd.exe
    Sleep 2100
               Send #+{Right}
               return
}
Else
{
  Run C:\Program Files\Parsec\parsecd.exe,C:\Program Files\Parsec
  WinWait ahk_exe Parsecd.exe
   Sleep 2100
               Send #+{Right}
               return
}
        return

 

Edited by Jayinem
Link to comment
Share on other sites

5 hours ago, Jayinem said:

I figured out the solution to running scripts on Parsec GUI is to add run as admin in the script. Now I can move it activate maximize it.

 

 

On 10/6/2024 at 3:01 PM, Sbaby said:

I’ve never encountered the issue you're describing. My only suggestion is to try running the AHK script as an administrator. If this works, it's likely a permissions issue, and you can then figure out how to address it accordingly.


was the first thing I told you to do, run the script with administrator privileges 😜👆

Link to comment
Share on other sites

  

I have a key that toggles Launchbox fullscreen and minimized and it was working fine but now I get a white screen.  I tried rebooting didn't help.

 

SetTitleMatchMode 2
DetectHiddenWindows On
#SingleInstance Force 
sc166::
   Toggle := !Toggle

        if (Toggle = 1) 
WinMaximize ahk_exe Launchbox.exe 
    else {
           
WinMinimize ahk_exe Launchbox.exe 
    } 
  

If I just click on Launchbox in the taskbar it opens up and minimizes normally, it's only when I hit the hotkey.

 

p.s. just updated my Nvidia graphics drivers to see if that could be it, but nope.

Edited by Jayinem
Link to comment
Share on other sites

This thread used to be very alive when people had questions someone would always be there to answer, now it's mostly dead.

Even though it's probably a waste of time since I never got my previous ? several 2 days ago I was wondering if someone knew how to make a window stay fullscreen (while showing taskbar) and write a loop that if it gets minimized it will re-activate it. I tried asking on autohotkey forums but got this guy mikey who has 28000 posts he's probably burned out he did help me write a script that makes Launchbox stay active however it makes my computer unusable because the loop is constantly checking if launchbox is the active window so if I try to click on something else like firefox too bad the script says launchbox needs to be the active window at all times, which is not what I asked for nor what I want. I want the loop to check if it's minimized if so maximize it, not check if it's the active window if not make it the active window.

This is the script that made it where I can't do anything but have launchbox the active screen.

If you try it you will have to kill the script because you can't do anything else on your computer it will make launchbox always the active window.

 
#SingleInstance
winTitle := "ahk_exe Notepad.exe"
Loop {
 WinWait % winTitle
 Loop {
  WinWaitNotActive
  If WinExist() {
   WinActivate
   SoundBeep 2500
  } Else Break
 }

 

Edited by Jayinem
Link to comment
Share on other sites

1 hour ago, Jayinem said:

I want the loop to check if it's minimized if so maximize it

No idea about your white screen issue.  But think this may help with the "maximize when minimized".

Loop
{
   WinGet,WinState,MinMax,ahk_exe notepad.exe
   If WinState = -1
       WinMaximize, ahk_exe notepad.exe	;msgbox, Window is Minimized
	
   If WinState = 0
      Continue	;msgbox, Window is neither
   If WinState = 1
      Continue	;msgbox, Window is Maximized
	
   sleep 500
}

You can of course remove the last if statement. The 2nd one is up to you.  They "Continue" right now so nothing happens.

  • Like 1
Link to comment
Share on other sites

YES it worked thank you so much Joe. This actually keeps it maximized if hitting minimize button and let's me do other tasks.

Is there any way I could do the same thing with it if it gets closed and minimized in the same script? One of my scripts is a very powerful escape key that combines both escape and alt+f4 and occasionally when I hit escape to leave a game it will also close launchbox. I want it to be like desktop wallpaper that always is there fullscreen (the coolest desktop wallpaper ever that scrolls through and plays lots of games).

 

Actually I already have it. After your help with 3 different scripts I have it where it maximizes when minimized, maximizes when restores and reopens after closing. Guess it doesn't matter that it's multiple scripts.

Maximize after restore:

#SingleInstance force
#Persistent

Loop
{
   if WinActive("ahk_exe LaunchBox.exe")
      WinMaximize
}

Re-opens if closed:
 

iTC_EXE     = "D:\Jay\Launchbox\Launchbox.exe"
iTC_Path    = "D:\Jay\Launchbox\"
iTC_imgName = Launchbox.exe

loop {
    
    Process, Exist, %iTC_imgName% ; check to see if iTeleportConnect is running
    If (ErrorLevel = 0) ; If it is not running
       {
       Run, %iTC_EXE%, %iTC_Path%, hide
       }
    Else ; If it is running, ErrorLevel equals the process id for the target program (Printkey). Then do nothing.
       {
        sleep 5
       }
}

 

And the white screen when I was hitting the hotkey doesn't matter now because I don't need a hotkey, I'd rather it just say maximized at all times and now it does.

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