Forum Discussion
I use the findchild method extensively too.
You can use wildcards to shorten it a bit.
so
Sys.Process("Myproc").FindChild("Name", "WPFObject(""StatusMessagesGridControl"")",9999)
could be
Sys.Process("Myproc").FindChild("Name", "*MessagesGrid*",9999)
The two would return the same object, presuming that the control in question was the only one with the string "MessagesGrid" as part of its name.
I also like to
Set MP = Sys.Process("Myproc")
at the beginning of the script, and then throughout the script use
MP.Findchild("Name", "*MessagesGrid*",9999)
That shortens it a bit more.
Finally, if the line is still too long there are ways to split the line...
For instance in VBScript, you can use an underscore right after the period, and put the rest of the command on the next line
I sometimes have to use multiple layers of findchild, so I'll put one findchild on each line this way
MP._
Findchild(<Stuff>)._
FindChild(<2nd Layer Stuff>)._
Click(X, Y)
is equivalent to
MP.Findchild(<Stuff>).FindChild(<2nd Layer Stuff>).Click(X, Y)
But the broken line is a bit easier to read.
I think there's a way to do this in every supported script language...
But I haven't found a way to automate making a findchild script line.
Perhaps these tricks can help you minimize how much you have to type, though, and make your scripts more readable to boot.
Related Content
- 2 years agocnt
Recent Discussions
- 10 hours agod_gfleetwood92
- 12 hours agoFFCB