Thank you! But it’s strange that to express gratitude it is obligatory to reply and raise the topic to the top; there is clearly a lack of a reputation system or a simple “thank you!” button. Therefore, I express my gratitude only now...
@mikeyww, I tried to embed your function in my script, and it turned out to be not so obvious. Everything works fine with the
go() function, but I tried, following your example, to wrap another simple function in
SetTimer(), but it doesn’t work. I'm guessing here again the reason is "AHK is single threaded!", so the only option is to keep the second script with your function open?
Code: Select all
SoundBeep 1500
SetTimer NotepadEnum, -1
SoundBeep 1000
waitCPU(15)
NotepadEnum() {
SetKeyDelay(10, 10)
Loop WinGetCount('ahk_class Notepad') {
SendEvent('#t{End}{Enter}{Tab ' A_Index-1 '}{Enter}')
WinSetTitle(A_Index '. ' RegExReplace(WinGetTitle('A'), '[0-9]\.\s'), 'A')
}
}