Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#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@…>, 16 years ago

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, 16 years ago

Version: Other

Automatic ticket cleanup.

comment:3 by Valik, 16 years ago

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, 16 years ago

Type: BugFeature Request
Version: Other

comment:5 by MrCreatoR <mscreator@…>, 16 years ago

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.