Jump to content

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


Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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?

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