Upon clicking shortcut open game, and AHK scripts, as well as close upon App/Game closing.

Post gaming related scripts
sashaatx
Posts: 333
Joined: 27 May 2021, 08:27
Contact:

Upon clicking shortcut open game, and AHK scripts, as well as close upon App/Game closing.

Post by sashaatx » 12 Jan 2022, 02:06

This script set will auto open game, peripherals, and autohotkey scripts. And close when Game Closes.

Im a wiki warrior, if you find an error, redundancy, or inefficiency, please let me know.

This code checks for the game Rainbow Six to have Closed every 10 seconds. If game closes, it sends "Pause" key, found in all AHK files that I want to close when the game closes.

Code: Select all

#Persistent


If ProcessExist("RainbowSix.exe")
{
        Sleep 10000
}
Else
{ 
    
    Send, Pause
    Suspend,Off
    ExitApp
    }

    
ProcessExist(Name){
    Process,Exist,%Name%
return Errorlevel
} 



~F2::Suspend
return

~Pause::
    Suspend,Off
    ExitApp
   
Script I use for rainbow six that I want to auto open when game launches without a background app watching.

Code: Select all

 
#Persistent

~RButton & 6::Return
~RButton & 5::Return

7::6
Return

 	~F3::Suspend
	return

   ~Pause::
    Suspend,Off
    ExitApp

  
This I have Saved as .bat file. Second and third line, replace with autohotkeyscripts. Point first line to game shortcut. I save this bat file hidden away, and "send to desktop" as shortcut that way I can have a custom icon or add to steam library as replacement.

Code: Select all

Start ""  "C:\Users\dower\Desktop\DESKTOP GAMES\Tom Clancy's Rainbow Six Siege.url"

Start ""  "C:\Users\dower\Desktop\AutoScript\r6.ahk" 

Start ""  "C:\Users\dower\Desktop\AutoScript\r6 continuom.ahk" 

Start ""  "C:\Program Files\LGHUB\lghub.exe"

Return to “Gaming Scripts (v1)”