redpicker Posted September 19, 2012 Share Posted September 19, 2012 (edited) OK, I have a script that interacts with a intranet webpage that provides access to a database. The only access I have to this database is through this intranet webpage. When I try to run LoadWait through this webpage (because the repsonse from the database is slow), it seems that there is one chance in about 100,000 that the loadwait function will fail (see previous topic LoadWait Error). I have given up on trying to prevent this from occuring. By stragic use of delays, I have greatly reduced this error from occuring, but I cannot eliminate it, so I am resigned to live with it. When this error occurs, the AutoIt script stops and displays an Error Window: --------------------------- AutoIt Error --------------------------- Line 574 (File "C:\Program Files (x86)\AutoIt3\Include\IE.au3"): While Not (String($o_object.document.readyState) = "complete" Or $o_object.document.readyState = 4 Or $f_Abort) While Not (String($o_object.document.readyState) = "complete" Or $o_object.document.readyState ^ ERROR Error: The requested action with this object has failed. --------------------------- OK --------------------------- I would like to run another script to detect when this window appears, and when it does, to click the "OK" button, then shut down the IE window, Close and save an Excel worksheet I am using to store the inforamtion I get from the database, then restart the original script. here is the script #include <IE.au3> #include <Excel.au3> Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase While 1 If WinExists("AutoIt Error") Then WinActivate("Autoit Error") Sleep(500) Send("{ENTER}") Sleep(1000) $oExcel = _ExcelBookAttach("ExcelSheet") _ExcelBookClose($oExcel,1,0) Sleep(1000) MsgBox(0,"Error Catcher","Excel should now be closed") $oIE=_IEAttach("Database") Sleep(1000) _IEQuit($oIE) MsgBox(0,"Error Catcher","Database should now be closed") Sleep(5000) run("C:UsersDocumentsAutoIt FolderDatabase Reader 2011-7") Else Sleep (1000) Msgbox(0,"Autoit Window","Didn't Identify WIndow") EndIf WEnd This seems like it should be an easy script to write, but it doesn't work. Is the problem that I cannot have two autoit programs running at the same time? Anybody have any suggestions how I can shut down the error window and restart the original program (Database Reader 2011-7)? Thanks Redpicker Edited September 19, 2012 by redpicker Link to comment Share on other sites More sharing options...
RedneckTech Posted September 19, 2012 Share Posted September 19, 2012 Try fixing your code. right now it is difficult to decipher (missing indents). I have done something kinda like this in the past, but having trouble deciphering what you have there. Link to comment Share on other sites More sharing options...
bluebearr Posted September 20, 2012 Share Posted September 20, 2012 Not sure what part "doesn't work", but it seems like your Run command is truncated - I don't see a .au3 extension on the script that you are trying to run, and it seems to be missing the profile folder name within the Users directory. Check and make sure that the path is correct. Also, if you have your system set up to edit scripts when you double-click them, the Run command won't work by just referring to the script. Try including the full path to the Autoit3 executable. Something like: Run('"C:Program Files (x86)AutoIt3AutoIt3.exe" "C:UsersbluebearrDocumentsScriptstest.au3"') BlueBearrOddly enough, this is what I do for fun. 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