Jump to content
Sign in to follow this  

Return value of functions

Recommended Posts



I have finished my first Autoit script.

It opens an explorer window, type a login/password, executes a query and logout.

Now, that everything is working properly, I need to set some error handlers.

In a normal script language I would check the result of each function call.

How should I do in Autoit?

For example:

WinWaitActive("GPD - Windows Internet Explorer","http://gpden.site.com.br/logout.asp")

How can I check if the window really appeared as expected? How do I set a maximum waiting time for this call?

Thank you for reading.

Share this post

Link to post
Share on other sites

need to just check the return values for each Function you use WinWaitActive is:

Return Value

Success: Returns 1.

Failure: Returns 0 if timeout occurred.

so ur check would be somethin like

$Timeout = 30000
$val = WinWaitActive("GPD - Windows Internet Explorer","http://gpden.site.com.br/logout.asp",$Timeout)
If $val = 0 Then MsgBox (0,"ERROR","WinWaitActive")

Return Values and Extended Style controls like Timeout for WinWaitActive are all Available in the Helpfile

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

Share this post

Link to post
Share on other sites

You have a good example from ofLight. Read the help file for each function you want error checking on. Some return 0 for an error, others return -1, still others don't indicate error that way at all but set the @error macro instead. So keep in mind it depends on the function you are checking.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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