Jump to content

Changing class name


Davey
 Share

Recommended Posts

Hi,

I've been using Autoit for a while however I've had a break for some time (excuses over with), I've tried searching for a solution but my lack of google-fu has left me hanging.

I'm trying to interact with a systree control and was making progress but when i tried my script on another PC I noticed the CLASS name had changed albeit very slightly:

from - WindowsForms10.SysTreeView32.app.0.34f5582_r14_ad11

to - WindowsForms10.SysTreeView32.app.0.34f5582_r28_ad11

Obviously this is enough to stop my script from working and i can't for the life of me think of a way round this, how can i query for the classname of the control? If this was a window i'd have no problems but it isn't or am i missing something really obvious?

If i just had a way of putting a * wildcard or ? single character replacement, maybe a way of using regexp to identify that string?

I found the following but i'm not sure if it would help me anyway - 

 

Any help would be greatly appreciated, even just a pointer in the right direction if it is something obvious.

 

Link to comment
Share on other sites

Over time, I've noticed that a fair few people have trouble with winforms classes. It's almost like they have a "salt" after the classname.

Is there no other way you can identify the control, like by its text or position or something?

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Yeh it's very weird I think I will have to resort to using text for identification as you suggest, not the best but still workable.

Is there no way of using regex to match the ClassnameNN/string somehow?

 

It's to interact with the SCOM interface if anyone was interested (and/or knows some other funky method).

Link to comment
Share on other sites

30 minutes ago, Davey said:

Is there no way of using regex to match the ClassnameNN/string somehow?

Quote

e.g. List windows matching Title defined by a regular expression

WinList("[REGEXPTITLE:(?i)(.*SciTE.*|.*Internet Explorer.*)]")

Window Handles / HWNDs

from the helpfile: Using AutoIt => Window Titles and Text (Advanced)

Link to comment
Share on other sites

I think that will help me progress with that i want thanks AutoBert!

I do use AutoIT's help file as it's definitely one of the best resources for a given product I've come across, i just didn't see that particular page in reference to regex. My own stupid fault for using crappy search terms!!

 

Link to comment
Share on other sites

God how thick am I, how i didn't see REGEXPCLASS i do not know, for anyone else out there with a classname that methodically changes use regular expression.

Without posting the whole code, I changed:

$hWnd = ControlGetHandle("CSSProd - Operations Manager", "", "[CLASS:WindowsForms10.SysTreeView32.app.0.34f5582_r28_ad1; INSTANCE:1]")

to:

$hWnd = ControlGetHandle("CSSProd - Operations Manager", "", "[REGEXPCLASS:WindowsForms10\.SysTreeView32\.app\.0\.34f5582_r(\d{2})_ad1]")
 

Link to comment
Share on other sites

Yeh me too, i would love to be versed in regex but i just don't have enough use for it in my job to stay with it so to speak. I have to keep using something for it to sink in with any longevity hehe.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...