Modify

#1539 closed Feature Request (Rejected)

Add RegExp in CLASSNN / INSTANCE for control names

Reported by: MrCreatoR <mscreator@…> Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: regexp, class, instance, control, handle Cc:

Description

Sometimes there is need to get handle from controls that might have dynamic instances:

 $i = 1 To 10
    $hCtrl = ControlGetHandle("Title", "", "[CLASS:Sash;INSTANCE:" & $i & "]")
    If $hCtrl Then MsgBox(64, "", "hCtrl: " & $hCtrl & @CRLF & "Instance: " & $i)

so what i suguest is to add REGEXPCLASSNN or REGEXPINSTANCE support to the control name, then we could get the handle like this:

ControlGetHandle("Title", "", "[REGEXPCLASSNN:Sash\d+]")

Attachments (0)

Change History (5)

comment:1 by MrCreatoR <mscreator@…>, on Mar 26, 2010 at 1:27:26 PM

Oops, the first example is somehow was corrupted:

For $i = 1 To 10
    $hCtrl = ControlGetHandle("Title", "", "[CLASS:Sash;INSTANCE:" & $i & "]")
    If $hCtrl Then MsgBox(64, "", "hCtrl: " & $hCtrl & @CRLF & "Instance: " & $i)
Next

comment:2 by TicketCleanup, on Mar 26, 2010 at 2:00:02 PM

Version: Other

Automatic ticket cleanup.

comment:3 by Valik, on Mar 28, 2010 at 7:35:35 PM

Resolution: Rejected
Status: newclosed

What you ask for doesn't make sense to me. The instance is a contrivance of AutoIt used to uniquely identify multiple controls with the same class. Your proposed regular expression does not make sense because the class name is just "Sash" and the instance is appended by AutoIt. Even if AutoIt were to match run the regular expression against the composite name it would always match the first instance because the first instance would always match the pattern.

The loop you show is the correct way to handle this situation.

comment:4 by Valik, on Mar 28, 2010 at 7:36:01 PM

Type: BugFeature Request
Version: Other

comment:5 by MrCreatoR <mscreator@…>, on May 2, 2010 at 9:41:13 PM

Your proposed regular expression does not make sense because the class name is just "Sash" and the instance is appended by AutoIt.

Interesting, i didn't knew that (well, i did knew that the classes does not numerated, but i didn't thought that autoit adds the instances), thank you for clarifying this to me.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.