Jump to content
Abivb

How to specify dynamic classname to get handle

Recommended Posts

Local $currentFocus = ControlGetFocus("Window1")

;This returns TListBox101

Now i want to use this one to get the handle. I am not sure how i should specify here.I tried

ControlGetHandle("Window1","","[CLASSNAME:"+$currentFocus"]").It didnt work.

Sorry I am new to autoit.

Share this post


Link to post
Share on other sites
Posted (edited)

Hi @Abivb, and welcome to the AutoIt forums :welcome:

The string concat operator in AutoIt is &, so, try to use it instead of the plus symbol :)

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

@Abivb

If you look carefully in the Help file, you'll see that CLASSNAME is not a valid input for ControlGetHandle() function (and any other funxtion about Windows or Controls).

Try to use CLASSNN or CLASS and INSTANCE inputs:

ControlGetHandle("Window1","","[CLASSNN:" & $currentFocus & "]")

In the second option, you have to split the CLASS and the INSTANCE from the CLASSNN (should be CLASS:TListBox10; INSTANCE:1) :)


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

@Abivb

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

×
×
  • Create New...