Sign in to follow this  
Followers 0
chut7

WinWaitActive - return code in AutoItX different from AutoIt

3 posts in this topic

I am using AutoItX, but was using AutoIt documentation (since that is what comes up in Google Searches). I found a discrepency in the functionality of WinWaitActive. Initially, I thought I was just using an old version of the DLL, but I ruled that out and now see that my observed behaviour is in agreement with the AutoItX documentation. However, this would make it at odds with the AutoIt behaviour, so I want to confirm with the experts out there:

WinWaitActive

AutoIt:

Return Value

Success: Returns handle to the requested window. 
Failure: Returns 0 if timeout occurred.

AutoItX:

Return Value

Success: Returns 1. 
Failure: Returns 0 if timeout occurred.

The reason this is important to me is that I want to test that my application is capable of opening multiple windows. I wanted to grab the handle of the new window, and make sure it was different from the other one.

If this is the designed behaviour for AutoItX, the other way of doing this would be to call WinList(), but I can't seem to be able to get the array parsing working properly in perl.

my @RBList=$autoit->WinList("Windows Task Manager");
my $numwin=$RBList[0][0];
diag ("number of RB: $numwin");

This returns:

# number of RB: ARRAY(0x3343e4c)

So it seems perl isn't able to deal with the array that is returned (and I'll admit that I'm somewhat of a newbie at Perl as well).

Any tips would be appreciated!

Tim

Share this post


Link to post
Share on other sites



I am guessing here but it would look like it is constrained to an int.

The Java version specifies:

public int AU3_WinWaitActive(String szTitle, String szText, int nTimeout);
public int AU3_WinActive(String szTitle, String szText);

Something like this should be declared with the language you are using.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

I am guessing here but it would look like it is constrained to an int.

The Java version specifies:

public int AU3_WinWaitActive(String szTitle, String szText, int nTimeout);
public int AU3_WinActive(String szTitle, String szText);

Something like this should be declared with the language you are using.

Thanks for the reply...I'm doubtful that it's a type issue, since Perl typically is pretty good at that. Plus, the return value is, as far as I can tell, 0 or 1, not a handle like I'd expect.

I did end up getting the WinList to work just today...what WinList actually passes back is not an array, but a reference to an array. I had to dereference it in order to get the values. Something like:

my $RBList=$autoit->WinList("Windows Task Manager");

my @List2=@$RBList;

my $numwin=$List2[0][0];

diag ("number of RB: $numwin");

From here, getting the window references would be easy.

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  
Followers 0