crawdaddy Posted March 18, 2008 Share Posted March 18, 2008 (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 March 18, 2008 by crawdaddy Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 18, 2008 Share Posted March 18, 2008 if you post your code it would be easier to help Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 (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 March 18, 2008 by crawdaddy Link to comment Share on other sites More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 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 Link to comment Share on other sites More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 Is anything unclear Emiel? I usually encounter errors after sending the space Link to comment Share on other sites More sharing options...
Zedna Posted March 18, 2008 Share Posted March 18, 2008 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 Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 Thank you very much Zedna- "PBTreeView321" is the state of being active and not waiting? Link to comment Share on other sites More sharing options...
Zedna Posted March 18, 2008 Share Posted March 18, 2008 Thank you very much Zedna- "PBTreeView321" is the state of being active and not waiting?It's your control ClassNameNNIn your case use probably Edit1 Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 18, 2008 Share Posted March 18, 2008 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 More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 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. Link to comment Share on other sites More sharing options...
crawdaddy Posted March 18, 2008 Author Share Posted March 18, 2008 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 patientfixed, ok I will, Thank you Link to comment Share on other sites More sharing options...
Kilhian Posted March 18, 2008 Share Posted March 18, 2008 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 More sharing options...
Swift Posted March 18, 2008 Share Posted March 18, 2008 Put at the top to declare $Error: Global $Error=0 Link to comment Share on other sites More sharing options...
crawdaddy Posted March 19, 2008 Author Share Posted March 19, 2008 (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 March 19, 2008 by crawdaddy Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now