Jump to content
Sign in to follow this  
SeF

Function that wait until "inputbox is ready"

Recommended Posts

SeF

Hi there!

This is my first post here, and I hope that It will be the first of many. ;)

I really loved AutoIt! :)

Here is thing:

I created a script that automates filling some forms using WinWaitActive. But, there is sometimes that occurs some PC's lag (caused by memory or LAN issue) when switching between tabs/screens and my script don't work properly. And in these tabs, the program's title don't change and there aren't any "Visible Text" that I can use along with WinWaitActive.

Is there any function that "knows" when a InputBox is ready?

(I think that will solve my problem)

Thanks! B)


Share this post


Link to post
Share on other sites
PsaltyDS

Hi there!

This is my first post here, and I hope that It will be the first of many. ;)

I really loved AutoIt! :)

Here is thing:

I created a script that automates filling some forms using WinWaitActive. But, there is sometimes that occurs some PC's lag (caused by memory or LAN issue) when switching between tabs/screens and my script don't work properly. And in these tabs, the program's title don't change and there aren't any "Visible Text" that I can use along with WinWaitActive.

Is there any function that "knows" when a InputBox is ready?

(I think that will solve my problem)

Thanks! B)

Check the status of the control in a loop with something like ControlGetText() which will set @error if the control doesn't exist yet. Once it exists (@error = 0) use ControlSetText() or ControlSend() to input the text.

B)

P.S. Don't forget a short sleep like Sleep(10) to keep from hogging the CPU in your loop. B)

Edit: Good point by Yashied, below. Lots of choices. Sometimes you have controls that are greyed out until ready, so could also be:

If ControlCommand($hWnd, "", $CtrlID, "IsVisible") And ControlCommand($hWnd, "", $CtrlID, "IsEnabled") Then

Even works if the control is being created on a new window and might not exist yet, because ControlCommand() returns 0 if the control isn't found.

B)

Edited by PsaltyDS

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
Yashied
SeF

Thanks for the answers guys! ;)

I'm going to try something like this:

Local $hWnd = WinGetHandle("[CLASS:SAP_FRONTEND_SESSION]")
Func CheckScreen()
            If ControlCommand($hWnd, "", "Afx:10000000:10081", "isVisible") and ControlCommand($hWnd, "", "Afx:10000000:10081", "isEnabled") Then
                sleep(10) ;continues the script
            Else
                CheckScreen()
            EndIf
        EndFunc

Then, I will insert the CheckScreen() between each time that I change screens/tabs. The problem is that the software (SAP) has only 1 class/instance. But, I hope that will work :)

Edited by SilvioLobo

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.