Hi,
When I use GetControlText or PushButton etc... ,
It is hard to find the correct ClassName or Handle.
In most case, GetControlText works well.
Sometimes, GetControlText doesn't work because I don't know the correct ClassName or Handle.
I tried to use "View System Windows", but it is difficult to me.
I am ready to learn.
Please let me know where can I learn the skill to find ClassName or Handle.
Thank you.
How to find class, handle of Window or Dialog
Moderators: JRL, Dorian (MJT support)
View System Windows is a great tool. Its only drawback is that it displays everything and so its sometimes difficult to find exactly what you're looking for.
Try the script I posted HERE. It's primary drawback is that it does not display everything, It only gets a specific level of objects. But it can make getting to your specific window in View System Windows easier since you can search by window handle and get to the location faster.
Try the script I posted HERE. It's primary drawback is that it does not display everything, It only gets a specific level of objects. But it can make getting to your specific window in View System Windows easier since you can search by window handle and get to the location faster.
You can accomplish the same with GetTextAtPoint.
Give this script a try, it should click the correct button.
Give this script a try, it should click the correct button.
Code: Select all
Label>Loop
Wait>.1
//Visible Windows Only
Let>WF_TYPE=2
//Check if nag screen is open
IfWindowOpen>Total Commander
//Move cursor over the the #2 button
MouseOver>Total Commander,&2
//Get Cursor position
GetCursorPos>X,Y
//Subtract 32 from Y coordinates
//This will give us the position
//of the number of the button to press.
//Adjus it if the coordinates are not in
//the center of the number.
Let>Y=Y-32
//Used for testing purpose to make sure the
//coordinates are correct.
MouseMove>X,Y
//Retrieve the number at the set X,Y coordinates
GetTextAtPoint>X,Y,TheNumber,nChar
//MessageModal>Please press button Nr. %TheNumber% to start the program
//Lets press the correct button
IF>TheNumber=1
//Press button 1
MouseOver>Total Commander,&1
wait>0.5
LClick
WaitWindowClosed>Total Commander
Endif
IF>TheNumber=2
//Press button 2
MouseOver>Total Commander,&2
wait>0.5
LClick
WaitWindowClosed>Total Commander
Endif
IF>TheNumber=3
//Press button 3
MouseOver>Total Commander,&3
wait>0.5
LClick
WaitWindowClosed>Total Commander
Endif
Endif
//All Windows (Default)
Let>WF_TYPE=1
Goto>Loop
I found the code for GetControlText.
Thanks to JRL, Rain.
View System Windows

Thanks to JRL, Rain.
Code: Select all
wait>0.5
GetControlText>Total Commander,TPanel,2,strText
IF>strText=1
//Press button 1
MouseOver>Total Commander,&1
wait>0.5
LClick
Endif
IF>strText=2
//Press button 2
MouseOver>Total Commander,&2
wait>0.5
LClick
Endif
IF>strText=3
//Press button 3
MouseOver>Total Commander,&3
wait>0.5
LClick
Endif
View System Windows
