#1539 closed Feature Request (Rejected)
Add RegExp in CLASSNN / INSTANCE for control names
| Reported by: | 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 , 16 years ago
comment:3 by , 16 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
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 , 16 years ago
| Type: | Bug → Feature Request |
|---|---|
| Version: | Other |
comment:5 by , 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.

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