Jump to content
Sign in to follow this  
Zohar

[Solved] Specifying a ControlID Using a Partial String

Recommended Posts

Hi


I need to use ControlGetPos() on VLC's Video Output control.
This control's class is named differently each run of VLC:
On one run it may be "VLC video output 02E20328"
and on the second     "VLC video output 02D56114"

So the only known part is the beginning: "VLC video output ".


Is it possible somehow to reference a Control with a partial Class name?


Thank you

 

Edited by Zohar

Share this post


Link to post
Share on other sites
4 hours ago, Zohar said:

Is it possible somehow to reference a Control with a partial Class name?

Use REGEXPCLASS:

ControlGetPos("Title", "", "[REGEXPCLASS:(?i)VLC Video Output.*]")

:) 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Hi FrancescoDiMuro


Thank you very much.


I am curious to ask:
What does the "(?i)" before the string mean?
And also, why in the end there's a "." before the *?


Thank you

Share this post


Link to post
Share on other sites

@Zohar

The "i" at the start of the string is called a modifier, and it tells to the RegEx engine:

"Don't care about capitalization; threat VLC and vlc (and all the other possible combinations) in the same manner.

The ".*" at the end of the string, instead, is a metacharacter (the dot), and a quantifier (the asterisk), and they tell to the RegEx:

"After matching VLC Video Output, there could be 0 to N character (every character) after that string", so you don't need to worry about what does follow the string, but just be secure that VLC Video Output is in the string :)

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

Terrific, thank you so much.

I am using it, and it works.


I am also curious to ask,
If I ever want to get the Control's Name as string, and hold it in a variable,
Is there a way to List the controls that are on a Window (specified by a Window Handle)?

Share this post


Link to post
Share on other sites
5 minutes ago, Zohar said:

Is there a way to List the controls that are on a Window (specified by a Window Handle)?

You can use WindowGetClassList(), which returns a list of all the classes related to a Window.

Here it is an example :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@Zohar

Happy to have helped :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...