Jump to content

returning data from a function


Recommended Posts

This code looks for a popup window that may

or may not display, for valid reasons.

It clicks thru the window if it does come up,

or keeps going down the code, if it does not display.

How can I trap for an unexpected error as well

as the value returned by the function ?

The "signonwrong" is a test because if the window

displays, it should NOT find the "SignOn" button that is in fact there,

and should NOT send an ENTER.

$error = WinwaitActive("Display Form","SignOnwrong",5)

If $error = 0 Then

Send("{ENTER}")

Else

ContinueCase

EndIf

Link to comment
Share on other sites

This code looks for a popup window that may

or may not display, for valid reasons.

It clicks thru the window if it does come up,

or keeps going down the code, if it does not display.

How can I trap for an unexpected error as well

as the value returned by the function ?

The "signonwrong" is a test because if the window

displays, it should NOT find the "SignOn" button that is in fact there,

and should NOT send an ENTER.

$error = WinwaitActive("Display Form","SignOnwrong",5)

If $error = 0 Then

Send("{ENTER}")

Else

ContinueCase

EndIf

How about:

If WinwaitActive("Display Form","SignOnwrong",5) Then
    Send("{ENTER}")
 Else
    ContinueCase
EndIf

Note that WinWaitActive() waits for the window to have focus, not just exist. That may or may not be what you intended. WinWait() might be better.

:)

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
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...