Modify

Opened 10 years ago

Closed 10 years ago

Last modified 9 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 Changed 10 years ago by MrCreatoR <mscreator@…>

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 Changed 10 years ago by TicketCleanup

  • Version set to Other

Automatic ticket cleanup.

comment:3 Changed 10 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to 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 Changed 10 years ago by Valik

  • Type changed from Bug to Feature Request
  • Version Other deleted

comment:5 Changed 9 years ago by MrCreatoR <mscreator@…>

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.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.