Sorry, I didnt actually copy paste. Next time I'll make sure to do
But putting in the classname worked!
Though I still dont know why it wouldnt work without it. When I look
at the windows open, there's just one by the Title "Threshold", and
there's just one item under this with control id as 1.
--- In firstname.lastname@example.org
, "Dennis K. Paulsen"
> If this is a copy and paste of your code, a couple of thoughts:
> * print $label should be print $label1
> * There may be two controls on the form with the same window id
> (0x1). If that is the case, you can specify the class name to
> FindWindowLike to constrain the search more..
> * Finally, FindWindowLike returns an array of window handles, not a
> single window handle, so specifying it as a parameter to WMGetText
> directly is not a good idea, even though it may seem to work..
> Better to use ($varname) = FindWindowLike(..) convention and use
> $varname in the WMGetText call.
> Dennis K. Paulsen
> > The problem I realised was when the control id happens to be 1. I
> > have two input text boxes in one of my windows. The control ids
> are 1
> > and 2. The foll code returns the value :
> > my ($dlg) = FindWindowLike(0, "Threshold");
> > my ($label1) = WMGetText(FindWindowLike($dlg, "", "", 0x2));
> > print $label;
> > But when I replace 0x2 with 0x1, nothing gets printed. Any
> > Regards,
> > -skanitkar