How can I speed up the script's process of closing and opening other scripts? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
LG Zana
Posts: 33
Joined: 06 Dec 2021, 17:50

How can I speed up the script's process of closing and opening other scripts?

Post by LG Zana » 30 Nov 2022, 16:16

I have one script that I use with a toggle key to open and close other scripts, and I'm wondering how I can speed up the process. I'm not happy with how long it takes now; is it even possible to go faster?

Code: Select all

#HotkeyInterval 99000000
#KeyHistory 0
#MaxHotkeysPerInterval 99000000
#NoEnv
#Persistent
#SingleInstance force
DetectHiddenWindows, On
ListLines, Off
SendMode, Input
SetBatchLines, 10ms
SetKeyDelay, 0, 50

Abaddon = D:\MyScripts\Abaddon.ahk
All_in_Dota2 = D:\MyScripts\All-in.ahk
All_in_Dota2_Music = D:\MyScripts\All-in-Music.ahk
Chaos = D:\MyScripts\Chaos Knight.ahk
Enigma = D:\MyScripts\Enigma.ahk
FastShoot = D:\MyScripts\FAST_SHOOT.ahk
FastShootCrosshair = D:\MyScripts\FAST_SHOOT-Crosshair.ahk
FastShootMusic = D:\MyScripts\FAST_SHOOT-Music.ahk
FastShootPistols = D:\MyScripts\FAST_SHOOT-Pistols.ahk
FastShootRifles = D:\MyScripts\FAST_SHOOT-Rifles.ahk
Kunkka = D:\MyScripts\Kunkka.ahk
Legion = D:\MyScripts\Legion Commander.ahk
Pudge = D:\MyScripts\Pudge.ahk

*$^!a::
toggle1:=!toggle1
If (Toggle1 = 1)
{
	toggle8 := 0
	WinClose, %FastShoot% class AutoHotkey
	WinClose, %FastShootCrosshair% class AutoHotkey
	WinClose, %FastShootMusic% class AutoHotkey
	WinClose, %FastShootRifles% class AutoHotkey
	WinClose, %FastShootPistols% class AutoHotkey
	Run, "D:\MyScripts\Abaddon.ahk"
	Run, "D:\MyScripts\Chaos Knight.ahk"
	Run, "D:\MyScripts\Enigma.ahk"
	Run, "D:\MyScripts\Kunkka.ahk"
	Run, "D:\MyScripts\Legion Commander.ahk"
	Run, "D:\MyScripts\Pudge.ahk"
	Run, "D:\MyScripts\All-in.ahk"
	SoundPlay, D:\MyScripts\Resources\Sounds\ScriptsON.wav
	Return
}
Else
{
	WinClose, %Abaddon% class AutoHotkey
	WinClose, %Chaos% class AutoHotkey
	WinClose, %Enigma% class AutoHotkey
	WinClose, %Kunkka% class AutoHotkey
	WinClose, %Legion% class AutoHotkey
	WinClose, %Pudge% class AutoHotkey
	WinClose, %All_in_Dota2% class AutoHotkey
	WinClose, %All_in_Dota2_Music% class AutoHotkey
	WinClose, %FastShoot% class AutoHotkey
	WinClose, %FastShootCrosshair% class AutoHotkey
	WinClose, %FastShootMusic% class AutoHotkey
	WinClose, %FastShootRifles% class AutoHotkey
	WinClose, %FastShootPistols% class AutoHotkey
	SoundPlay, D:\MyScripts\Resources\Sounds\ScriptsOFF.wav
	Return
}
Return

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How can I speed up the script's process of closing and opening other scripts?  Topic is solved

Post by swagfag » 30 Nov 2022, 16:54

  • first check if theres a compelling reason to start/kill scripts just to (i presume) enable/disable a bunch of hotkeys. "i dont know how to code it differently" is not a compelling reason
  • merge scripts
  • adjust A_WinDelay, or otherwise use something else in place of WinClose


Post Reply

Return to “Ask for Help (v1)”