AHK - Need help with script (stuck at window detect)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

AHK - Need help with script (stuck at window detect)

Post by *LonerD »

TC 9.21a x32
Windows 10 x64 SL Home

Simple Autohotkey script:

Code: Select all

#NoEnv
#NoTrayIcon
#SingleInstance force

PostMessage, 0x433, 492,,, ahk_class TTOTAL_CMD
WinWait, ahk_class TDLGCONFIGALL
SendMessage, 0x201,,, TButton3, ahk_class TDLGCONFIGALL
SendMessage, 0x202,,, TButton3, ahk_class TDLGCONFIGALL

WinWait, ahk_class #32770
WinGet, hw_TTOTAL_32770, ID, A
SendMessage, 0x201,,, Button5, % "ahk_id " hw_TTOTAL_32770
SendMessage, 0x202,,, Button5, % "ahk_id " hw_TTOTAL_32770
ExitApp
Open Configuration, open Font window, press OK button.
Something strange happens when "Font" window appears.
Unexpected very long pause.
Why script can detect Configuration window quickly and stuck at Font window?

My first suspection was in ahk_class #32770 (most common class in different programs)...

But after replacing:

Code: Select all

WinWait, ahk_class #32770
WinGet, hw_TTOTAL_32770, ID, A
SendMessage, 0x201,,, Button5, % "ahk_id " hw_TTOTAL_32770
SendMessage, 0x202,,, Button5, % "ahk_id " hw_TTOTAL_32770
with:

Code: Select all

Sleep, 100
SendMessage, 0x201,,, Button5, A
SendMessage, 0x202,,, Button5, A
still the same long pause :|
Any ideas how make window more responsive?
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: AHK - Need help with script (stuck at window detect)

Post by *Stefan2 »

Try PostMessage for your left button down/up


 
User avatar
LonerD
Senior Member
Senior Member
Posts: 381
Joined: 2010-06-19, 20:18 UTC
Location: Makeyevka, Russia
Contact:

Re: AHK - Need help with script (stuck at window detect)

Post by *LonerD »

Stefan2 wrote: 2018-10-16, 17:56 UTC Try PostMessage for your left button down/up
Thank you.
I use "SendMessage, 0x201" and "SendMessage, 0x202" instead ControlClick in some scripts (it works more stable than ControlClick), but not yet faced with such situation :D .
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: AHK - Need help with script (stuck at window detect)

Post by *Hacker »

LonerD,
SendMessage waits 5 seconds for a non-existent answer. PostMessage does not.

HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Post Reply