Jump to content

[Solved]_ControlClick


Recommended Posts

Hire is the thing: I do a controlclick like this:

ControlClick($win, "", $class_Combobox & "14", "" ) ; Color depth

All works nice. After a while I try it again & it does not work. I use Autoit wingetinfo tool & find out that the Nr. 14 has changed to 16 or 11 or 21. Im confused. Is this thing possible or is it some kind of a bug, or something else?

I mean the instance nr usually never changes. I do not restart the program the nr is changing on the fly, so to say. If I restart the program the nr. is differrent than the one from last time I run the nLite.exe

Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

If it's ClassNN is not changing it's much better to use it instead. Otherwise, you have the option to enumerate the window children or descendants and use the string functions to see if it's first part matches $class_Combobox or better, send the message directly to this hwnd.

Link to comment
Share on other sites

If it's ClassNN is not changing it's much better to use it instead. Otherwise, you have the option to enumerate the window children or descendants and use the string functions to see if it's first part matches $class_Combobox or better, send the message directly to this hwnd.

HOW? can you show an example? $class_Combobox is always the same it never changes. I included control summary below, as you see the handle is also changing how can you use it?:

$win = 'nLite'
    $class_Combobox = 'WindowsForms10.COMBOBOX.app.0.33c0d9d'
                       
    ControlClick($win, "", $class_Combobox & "14", "" ) ; Color depth

>>>> Control <<<<
Class:  WindowsForms10.COMBOBOX.app.0.33c0d9d
Instance:   14
ClassnameNN:    WindowsForms10.COMBOBOX.app.0.33c0d9d14
ID: 68572
Text:   
Position:   48, 202
Size:   120, 21
ControlClick Coords:    45, 5
Style:  0x56010243
ExStyle:    0x00000000
Handle: 0x00010BDC

>>>> Control <<<<
Class:  WindowsForms10.COMBOBOX.app.0.33c0d9d
Instance:   7
ClassnameNN:    WindowsForms10.COMBOBOX.app.0.33c0d9d7
ID: 133944
Text:   
Position:   48, 202
Size:   120, 21
ControlClick Coords:    24, 11
Style:  0x56010243
ExStyle:    0x00000000
Handle: 0x00020B38
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

I see it's ClassnameNN gets changed as well. Enumeration is your choice then.

Edit: but it's position in the window gets never changed. Look at controls in the help file, you can use X \ Y \ W \ H - The position and size of a control.

Edited by Authenticity
Link to comment
Share on other sites

HOW? can you show an example? $class_Combobox is always the same it never changes. I included control summary below, as you see the handle is also changing how can you use it?:

$win = 'nLite'
    $class_Combobox = 'WindowsForms10.COMBOBOX.app.0.33c0d9d'
                       
    ControlClick($win, "", $class_Combobox & "14", "" ); Color depth

>>>> Control <<<<
Class:  WindowsForms10.COMBOBOX.app.0.33c0d9d
Instance:   14
ClassnameNN:    WindowsForms10.COMBOBOX.app.0.33c0d9d14
ID: 68572
Text:   
Position:   48, 202
Size:   120, 21
ControlClick Coords:    45, 5
Style:  0x56010243
ExStyle:    0x00000000
Handle: 0x00010BDC

>>>> Control <<<<
Class:  WindowsForms10.COMBOBOX.app.0.33c0d9d
Instance:   7
ClassnameNN:    WindowsForms10.COMBOBOX.app.0.33c0d9d7
ID: 133944
Text:   
Position:   48, 202
Size:   120, 21
ControlClick Coords:    24, 11
Style:  0x56010243
ExStyle:    0x00000000
Handle: 0x00020B38
If the GUI is created with a dynamic number of controls, then changing instance numbers are normal. You have to figure out what doesn't change. ClassNameNN is redundant because the NN part is just the instance number, so if the instance is changing, then ClassNameNN is changing.

Is the position constant? Then use the X/Y position.

Is the text of a button constant? Then check all the buttons looking for that text.

Is the first item of a control box always the same? Look for that.

Does it always occur just beneath a static label? Look for the label and do an offset from that.

Etc.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

There are several combo boxes & all have value:Default

The position does not seem to change. I tried & this works. Thankx.

$win = 'nLite'
    $class_Combobox = 'WindowsForms10.COMBOBOX.app.0.33c0d9d'
    
    For $i= 1 to 1000
        
        $pos = ControlGetPos($win, "", $class_Combobox & $i) ; Get y pos
        
        If $pos[1] == 202 then ExitLoop
    Next

    ControlClick($win, "", $class_Combobox & $i, "" )   ; Color depth
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...