Sign in to follow this  
Followers 0
crawdaddy

Hello, First post, winwaits and sleeps and errors..

14 posts in this topic

#1 ·  Posted (edited)

Thank you for reading. I am importing items into a program, when I am doing so,

I am currently opening the import/open dialog in the program, winwaiting till the

open window is active, selecting the correct item, sending tabs (move whats highlighted

in the import/open window) then a sleep 5000 waiting until the open window is active again,

and space (to press open) then a sleep 5000 to load the items.

It is a decently large list of items so it takes a while to load, my problem is, autoit starts

the next process before the program has completely loaded the item. And the process

usually works the first time around, but subsequent loops the system itself takes longer,

I have tried using status information of the window, I have tried putting ridiculously long

waits, but as I want this program to run for days on end.. hopefully, the waits of a 1-2

minutes will not suffice. I was wondering should I instead of mouse clicking the process

after the import, do a mouse move then a mousecursor check to see if it is still an hour glass,

If i do the process manually the hourglass appears, but when using the script the cursor stays

in arrow form as opposed to becoming a hourglass. I'm sorry If I am unclear in anyway.

I would be more than happy to provide any information. :)

Edited by crawdaddy

Share this post


Link to post
Share on other sites



if you post your code it would be easier to help


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

WinWaitActive("XML")
    ControlClick("XML", "", "Edit1")
    ClipPut($Gaskploc)
    Send("^v")
    Sleep(5000)
    Send("{TAB}")
    Sleep(5000)
    Send("{TAB}")
    Sleep(5000)
WinWaitActive("XML")
    Send("{SPACE}")
    sleep(5000)
        $error = 0
        $error = WinWaitActive("Autopart2", "module", 15)
        If $error = 1 Then
            sleep(15000)
        Send("{SPACE}")
    EndIf
    Sleep(15000)
    WinWaitActive("Autopart2", "Product")
    Sleep(15000)
    WinWaitActive("Autopart2", "Product")
    Sleep(15000)
    WinWaitActive("Autopart2", "Product")
    Sleep(15000)
    MouseClick("left", 100, 50)
    WinWaitActive("Autopart2", "Program")
    Sleep(5000)

Edited by crawdaddy

Share this post


Link to post
Share on other sites

XML is the open dialog, Autopart2 is the program, gaskploc is information, in between when it sends the space and mouseclicks left are my problem areas

Share this post


Link to post
Share on other sites

Is anything unclear Emiel? I usually encounter errors after sending the space

Share this post


Link to post
Share on other sites

Your code doesn't make sense to me.

Post some screenshots and tell us what application are you trying to automatize.

About wait cycles: I used ControlGetFocus in loop while it doesn't return @error if I couldn't use Cursor state or some other method like text from statusbar or so.

Trick is in that if applucation is not responding during processing ControlGetFocus returns @error.

; wait while import is finished (until treeview gets back its focus)
        While ControlGetFocus("My app title") <> "PBTreeView321"
              Sleep(100)
            Wend

Share this post


Link to post
Share on other sites

Thank you very much Zedna-

"PBTreeView321" is the state of being active and not waiting?

Share this post


Link to post
Share on other sites

Same here .. does not make any sense to me ..

also add the code between [ autoit ] code here [ /autoit ] (remove the spaces between [ ] makes it easier to read

The text "if you post your code it woul be easier to help" was a tip .. if you post your code.. you will get more response..

futher be patient


Best regards,Emiel Wieldraaijer

Share this post


Link to post
Share on other sites

Thank you, The program is for work, as it's a big company, I don't think it would be an issue posting pictures. But I better not.

Share this post


Link to post
Share on other sites

Same here .. does not make any sense to me ..

also add the code between [ autoit ] code here [ /autoit ] (remove the spaces between [ ] makes it easier to read

The text "if you post your code it woul be easier to help" was a tip .. if you post your code.. you will get more response..

futher be patient

fixed, ok I will, Thank you

Share this post


Link to post
Share on other sites

WinWaitActive("XML");wait window xml is active
ControlClick("XML", "", "Edit1") ;click on button "edit1"
ClipPut($Gaskploc); put a var in clipboard
Send("^v"); send paste
Sleep(5000);wait 5 sec
Send("{TAB}")
Sleep(5000)
Send("{TAB}")
Sleep(5000)
WinWaitActive("XML")
Send("{SPACE}")
sleep(5000)
$error = 0
$error = WinWaitActive("Autopart2", "module", 15)
If $error = 1 Then
sleep(15000)
Send("{SPACE}")
EndIf
Sleep(15000)
WinWaitActive("Autopart2", "Product")
Sleep(15000)
WinWaitActive("Autopart2", "Product")
Sleep(15000)
WinWaitActive("Autopart2", "Product")
Sleep(15000)
MouseClick("left", 100, 50)
WinWaitActive("Autopart2", "Program")
Sleep(5000)

is it all the code?

your script is waiting window focus... does xml popup? andd what about window autopart2?

where do you declare $Gaskploc?

Share this post


Link to post
Share on other sites

Put at the top to declare $Error:

Global $Error=0

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

@Kilhian

Its the part that errors,

XML is opened to import xml,

autopart2 is always open,

$Gaskploc is an excel file that information about car gaskets is taken from.

Edited by crawdaddy

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