need fasten a script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
waa2
Posts: 6
Joined: 20 Nov 2020, 15:09

need fasten a script

21 Jul 2021, 05:08

Hey, guys
I have made a script to send enter at once to multiple windows of hidden processes of the same class, but sadly it works as i want randomly
for example, i want to send enter to 16 windows, sometimes it sends very fast as i want, some other times it sends but slower than what i want leading to achieve 50-70% of the desired purpose
so, may anyone kindly suggest a solution for this?
Thanks in advance
here's my script

Code: Select all

SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows, on
toggle = -1
#MaxThreadsPerHotkey 20000000000000
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A
SetBatchLines, -1
SetKeyDelay, -1, -1
SetMouseDelay, -1
SetDefaultMouseSpeed, 0
SetWinDelay, -1
SetControlDelay, -1
SendMode Input
;OPTIMIZATIONS END


q::
	sleep, -1
WinGet, winList, List, ahk_class pek
	sleep, -1
loop, %winList%
	sleep, -1
	loop,
	{
	SetControlDelay -1
	sleep, -1
	ControlSend,, {Enter},% "ahk_id " winList%a_index%,,,, NA
	sleep, -1
	}
Return

^esc::exitapp
+z::suspend
^Numpad0:: Reload[/Codebox]
User avatar
mikeyww
Posts: 26885
Joined: 09 Sep 2014, 18:38

Re: need fasten a script

21 Jul 2021, 05:33

At the moment, your Loop, %winlist% applies only to the single statement that follows it. This is then followed by an infinite loop. I would remove the second, infinite loop and then examine placement of the braces. The sleep commands seem unnecessary.
waa2
Posts: 6
Joined: 20 Nov 2020, 15:09

Re: need fasten a script

31 Jul 2021, 23:11

Ok sir thanks alot for helping mr, I will try it and report, but sorry again, is it possible to spam a controlsend or a controlclick to multiple inactive windows? Like spamming left click, my aim is to spam left click or enter for multiple inactive windows.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CrowexBR, Theda and 277 guests