Hi, I'm having trouble solving a problem with the following code:
Code: Select all
F6::
if WinActive("ahk_class CabinetWClass")
{
ControlGetPos, x, y, w, h, Edit1, ahk_class CabinetWClass
MouseClick, Left, x + w, y + h/2, 1, 0
Sleep, 100
ControlGetText, OutputVar, Edit1, ahk_class CabinetWClass
ToolTip, %OutputVar%
Sleep, 500
ToolTip
}
return
The problem is this: The AHK can not find control Edit1 in ahk_class CabinetWClass if I have never clicked on Edit1. That is, if I open a folder and never click Edit1, the AHK can not find Edit1, but if I click at least once on edit1 then the AHK can always find Edit1 until I close all the folders, after that the problem comes back. It seems that AHK loses reference to Edit1.