Speleologist Posted September 16, 2013 Share Posted September 16, 2013 I am trying to create a script to automate a long winded reporting process. A small input element of this is some HTML reports from some iFolder servers, all of which have identical versions of the software and use an identical user name and password. The finished intention is a script that , once the user has input the required parameters, runs without intervention and hidden, producing only the finished reports. (This process will be slow as there is a significant amount of writing arays to Excel and suchlike, so it may normally be launched and left to run overnight). It logs in successfully, but fails to do anything after logging in. However if I disable the _IEQuit, so that the window stays open and run it again, all is fine. I'm struggling to see why, or how to solve it. Here's the script expandcollapse popup#include <IE.au3> #include <Array.au3> #include <File.au3> Global $aSites Global $SiteFile = '\\hccarchive02\vol1\logs\if_mig\sites.txt' Global $Username = InputBox('iFolder Server Reports', 'Please enter the iFolder admin account User name', '') Global $Password = InputBox('iFolder Server Reports', 'Please enter the password for the iFolder admin account', '', '*') _FileReadToArray($SiteFile, $aSites) For $i = 1 To $aSites[0] GetReport($aSites[$i]) ; More Stuff Next Func GetReport($Site) $oIE = _IECreate('https://ifolder.' & $Site & '.hertscc.gov.uk/iFolderServer/Admin/Reporting.htm', 0 , 1 , 1) _IELinkClickByText($oIE, 'Continue to this website (not recommended).') Local $oFrame = _IEFrameGetObjByName($oIE, 'MAINFRAME') Local $oForm = _IEFormGetObjByName($oFrame, 'mainform') Local $oUsername = _IEFormElementGetObjByName($oForm, "User") Local $oPassword = _IEFormElementGetObjByName($oForm, 'Password') _IEFormElementSetValue($oUsername, $Username, 1) _IEFormElementSetValue($oPassword, $Password, 1) _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') sleep(2000) $oFrame2 = _IEFrameGetObjByName($oIE, 'NAVFRAME') _IELinkClickByText($oFrame2, 'User Accounts') Sleep(500) Local $oForm2 = _IEFormGetCollection($oFrame, 0) _IEFormImageClick($oForm2, '/iFolder/adminconsole/buttons/btndisplay_en.gif', 'src') $oTable = _IETableGetCollection($oFrame, 1) $aReport = _IETableWriteToArray($oTable, True) _ArrayDisplay($aReport) ; _IEQuit ($oIE) EndFunc ;==>GetReport and here's the code for the frame that causes the problem: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=utf-8"> <TITLE>Navigation</TITLE> <link rel="stylesheet" href="/iFolder/adminconsole/html/hf_style.css"> </HEAD> <BODY BGCOLOR="#DFDDD5"> <div class="head4"> Reporting</div> <div class="task1"> <A HREF="Reporting.htm&GeneralInformation" target="MAINFRAME">General Info</A></div> <div class="task1"> <A HREF="Reporting.htm&iFolder_Servers" target="MAINFRAME">iFolder Servers</A></div> <div class="task1"> <A HREF="Reporting.htm&LDAPDirectories" target="MAINFRAME">User LDAPs</A></div> <div class="task1"> <A HREF="Reporting.htm&UserAccounts" target="MAINFRAME">User Accounts</A></div> </BODY> </HTML> First time the login completes but the diagnostic MsgBox never displays. Second time it runs fine and I get all the data in the array.This is what I see in the Scite debug when it fails: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" /UserParams +>12:58:22 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00000809 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt3 +>12:58:22 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop C:\Program Files\AutoIt3\Include\IE.au3 (638) : ==> The requested action with this object has failed.: While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top.document.readyState = 4 Or $f_Abort) While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top^ ERROR ->12:58:39 AutoIt3.exe ended.rc:1 Suggestions gratefully received. Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 first: can you answer to me ? did you try this: try use: $oForm = _IEFormGetCollection($oIE, 0) instead of $oForm = _IEFormGetObjByName($oFrame, 'mainform')how I sugest to You here: secondly: how you get reference to : $o_object and $oTemp Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 16, 2013 Author Share Posted September 16, 2013 Hi mlipok, That resolved my earlier issue, but doesn't make any difference to this one. $o_object and $oTemp are variables in the UDF, not my script. Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 (edited) Hi mlipok, That resolved my earlier issue, but doesn't make any difference to this one. So in the future it would be nice if someone helps you, if you wrote back and confirmed that the solution was helpful.Secondly, it would be good if you apply using the "Mark Solved" (see my signature) $o_object and $oTemp are variables in the UDF, not my script. but now a... I see now C:\Program Files\AutoIt3\Include\IE.au3 ...... So now tell me, to what point do you think the script is working well? EDIT: besides if the previous solution resolved your earlier issue, why you still using this : Local $oForm = _IEFormGetObjByName($oFrame, 'mainform') EDIT: o sorry I was bussy, emergency call and I dont see your answer in previous post when I start writing this message I express deep regret Edited September 16, 2013 by mlipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 16, 2013 Author Share Posted September 16, 2013 So in the future it would be nice if someone helps you, if you wrote back and confirmed that the solution was helpful.Secondly, it would be good if you apply using the "Mark Solved" (see my signature) As indeed I did, once I'd got free of the inevitable interruptions at work. What appears to happen is the line _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') works, because the post login page loads correctly. However the script just exits at that point and the following MsgBox never displays. If I then run the script again, without closing the previous IE window it all works fine. The MsgBox shows no error, the subsequent commands complete and the array displays with the correct data. Link to comment Share on other sites More sharing options...
Speleologist Posted September 16, 2013 Author Share Posted September 16, 2013 o sorry I was bussy, emergency call and I dont see your answer in previous post when I start writing this message I express deep regret No problem at all. We're all busy people. Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 I was busy so back to topic: I ask you why you still using this: Local $oForm = _IEFormGetObjByName($oFrame, 'mainform') modyfi your script Local $oFrame = _IEFrameGetObjByName($oIE, 'MAINFRAME') Local $oForm = _IEFormGetObjByName($oFrame, 'mainform') ConsoleWrite('IsObj($oForm) = ' & IsObj($oForm) &@CRLF) Local $oUsername = _IEFormElementGetObjByName($oForm, "User") ConsoleWrite('IsObj($oUsername) = ' & IsObj($oUsername) &@CRLF) Local $oPassword = _IEFormElementGetObjByName($oForm, 'Password') ConsoleWrite('IsObj($oPassword) = ' & IsObj($oPassword) &@CRLF) and take back your console output. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 16, 2013 Author Share Posted September 16, 2013 This is getting curioser. On the first instance, when it fails I get the following: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" /UserParams +>16:52:32 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00000809 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt3 +>16:52:32 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop IsObj($oForm) = 1 IsObj($oUsername) = 1 IsObj($oPassword) = 1 C:\Program Files\AutoIt3\Include\IE.au3 (638) : ==> The requested action with this object has failed.: However at the second run IsObj returns 0 for all >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" /UserParams +>16:55:17 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00000809 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt3 +>16:55:17 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Robin Sermon\My Documents\Ifolder Migration\Post Migration\Analysis\IE_Test.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop --> IE.au3 V2.4-0 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch IsObj($oForm) = 0 --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType IsObj($oUsername) = 0 --> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType IsObj($oPassword) = 0 --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Error from function _IEFormImageClick, $_IEStatus_InvalidDataType --> IE.au3 V2.4-0 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch --> IE.au3 V2.4-0 Error from function _IEFormImageClick, $_IEStatus_InvalidDataType +>16:55:42 AutoIt3.exe ended.rc:0 >Exit code: 0 Time: 25.612 However at this point the rest of the script works. Doesn't seem to make sense to me. Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 where / when is the second one ? talk me something more what change in mean while ? Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 (edited) Do not use Sleep try to use _IELoadWait($oIE) why you redeclaring $oFrame2 ? EDIT: besides You clicking 4 times why you not waiting 4 times ? change your script and give what you have Edited September 16, 2013 by mlipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
DW1 Posted September 16, 2013 Share Posted September 16, 2013 As indeed I did, once I'd got free of the inevitable interruptions at work. What appears to happen is the line _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') works, because the post login page loads correctly. However the script just exits at that point and the following MsgBox never displays. If I then run the script again, without closing the previous IE window it all works fine. The MsgBox shows no error, the subsequent commands complete and the array displays with the correct data. Sounds to me like the page isn't finished loading when you are running your script. Even though you are waiting for the page to load in IECreate I would bet there is more going on after IE is saying the loading is complete. If this is the case (can test with a sleep/msgbox delay after IE create but before the rest of the script), then you should create your own waiting loop that waits on a specific element that only exists after the page is truly fully loaded. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
mLipok Posted September 16, 2013 Share Posted September 16, 2013 Sounds to me like the page isn't finished loading when you are running your script. Even though you are waiting for the page to load in IECreate I would bet there is more going on after IE is saying the loading is complete. If this is the case (can test with a sleep/msgbox delay after IE create but before the rest of the script), then you should create your own waiting loop that waits on a specific element that only exists after the page is truly fully loaded. @danwilli I think the same way. I not wanting to give the fish immediately. Better to give a fishing rod. No offense. @speleologist Because of that I give you a step by step info , to show you how you can to learn what is wrong Do not use Sleep try to use _IELoadWait($oIE) besides You clicking 4 times why you not waiting 4 times ? My question was simple and easy to understand. I hope I have helped you expand and systematize your knowledge. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 17, 2013 Author Share Posted September 17, 2013 I'm not getting much chance to look at this today so far. Hopefully things will be less rushed this afternoon. Do not use Sleep try to use _IELoadWait($oIE) Have tried this, and also putting sleep statements after each action. It makes no difference. Also the help file suggests that _IELoadWait is already called by _IECreate and the evidence why you redeclaring $oFrame2 ? I'm not redeclaring it. It's declared once and references the 'NAVFRAME', a different frame. I declare $oForm2, to reference a new form that has loaded into 'MainFrame' So where have I got to? Well none of the sleep or _IELoadWait have made a difference, but what I have found is the following. If there is no logged in IE window open the script exits immediately on clicking the login button. The page then loads but the script has already exited. The MsgBox (below) never displays. $Login = _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') MsgBox ( 0 , 'Login' , $Login ) At this point the error is from line 672 of the UDF, which is the _IELoadWait function. C:\Program Files\AutoIt3\Include\IE.au3 (638) : ==> The requested action with this object has failed.: While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top.document.readyState = 4 Or $f_Abort) While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top^ ERROR So it looks like a problem with the "top.document.readyState" property of the main window, but putting delays in doesn't improve things. Looking at it a bit further the line where the error occurs is part of a "Case Else", where the object passed to _IELoadWait is not one of the following object types: browser window document Yet if I understand what's going on correctly, the value being passed as $o_object is the object $oIE that was created by _IECreate. I'm still puzzled, but I'll hopefully get a chance to experiment more this afternoon. Link to comment Share on other sites More sharing options...
mLipok Posted September 17, 2013 Share Posted September 17, 2013 (edited) Have tried this, and also putting sleep statements after each action. It makes no difference. Also the help file suggests that _IELoadWait is already called by _IECreate and the evidence _IECreate indeed use _IELoadWait the same with _IEFormImageClick _IELinkClickByText when you using this function do the page Load new contents ? I'm not redeclaring it. It's declared once and references the 'NAVFRAME', a different frame. I declare $oForm2, to reference a new form that has loaded into 'MainFrame' I talking about this: $oFrame2 = _IEFrameGetObjByName($oIE, 'NAVFRAME') _IELinkClickByText($oFrame2, 'User Accounts') Sleep(500) Local $oForm2 = _IEFormGetCollection($oFrame, 0) is this better ? Local $oFrame2 = _IEFrameGetObjByName($oIE, 'NAVFRAME') _IELinkClickByText($oFrame2, 'User Accounts') Sleep(500) $oForm2 = _IEFormGetCollection($oFrame, 0) EIDT: F..k ... I must change my glasses, all is right here with declaring Yet if I understand what's going on correctly, the value being passed as $o_object is the object $oIE that was created by _IECreate. Not always this can be Form or Frame or other one. Besides can you describe what website do when you click _IELinkClickByText($oIE, 'Continue to this website (not recommended).') _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') _IELinkClickByText($oFrame2, 'User Accounts') _IEFormImageClick($oForm2, '/iFolder/adminconsole/buttons/btndisplay_en.gif', 'src') Edited September 17, 2013 by mlipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
mLipok Posted September 17, 2013 Share Posted September 17, 2013 try this: expandcollapse popup#include <IE.au3> #include <Array.au3> #include <File.au3> Global $aSites Global $SiteFile = '\\hccarchive02\vol1\logs\if_mig\sites.txt' Global $Username = InputBox('iFolder Server Reports', 'Please enter the iFolder admin account User name', '') Global $Password = InputBox('iFolder Server Reports', 'Please enter the password for the iFolder admin account', '', '*') _FileReadToArray($SiteFile, $aSites) For $i = 1 To $aSites[0] GetReport($aSites[$i]) ; More Stuff Next Func GetReport($Site) $oIE = _IECreate('https://ifolder.' & $Site & '.hertscc.gov.uk/iFolderServer/Admin/Reporting.htm', 0, 1, 1) _IELinkClickByText($oIE, 'Continue to this website (not recommended).') Local $oFrame = _IEFrameGetObjByName($oIE, 'MAINFRAME') ConsoleWrite('IsObj($oFrame) = ' & IsObj($oFrame) & ' ObjName = ' & String(ObjName($oFrame)) & ' Obj.type = ' & $Obj.type & @CRLF) Local $oForm = _IEFormGetCollection($oFrame, 0) ConsoleWrite('IsObj($oForm) = ' & IsObj($oForm) & ' ObjName = ' & String(ObjName($oIE)) & ' $oIE.type = ' & $oIE.type & @CRLF) Local $oUsername = _IEFormElementGetObjByName($oForm, "User") ConsoleWrite('IsObj($oUsername) = ' & IsObj($oUsername) & ' ObjName = ' & String(ObjName($oUsername)) & ' $oUsername.type = ' & $oUsername.type & @CRLF) Local $oPassword = _IEFormElementGetObjByName($oForm, 'Password') ConsoleWrite('IsObj($oPassword) = ' & IsObj($oPassword) & ' ObjName = ' & String(ObjName($oPassword)) & ' $oPassword.type = ' & $oPassword.type & @CRLF) _IEFormElementSetValue($oUsername, $Username, 1) _IEFormElementSetValue($oPassword, $Password, 1) _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') sleep(2000) Local $oFrame2 = _IEFrameGetObjByName($oIE, 'NAVFRAME') ConsoleWrite('IsObj($oFrame2) = ' & IsObj($oFrame2) & ' ObjName = ' & String(ObjName($oFrame2)) & ' $oFrame2.type = ' & $oFrame2.type & @CRLF) _IELinkClickByText($oFrame2, 'User Accounts') Sleep(500) Local $oForm2 = _IEFormGetCollection($oFrame, 0) ConsoleWrite('IsObj($oForm2) = ' & IsObj($oForm2) & ' ObjName = ' & String(ObjName($oForm2)) & ' $oForm2.type = ' & $oForm2.type & @CRLF) _IEFormImageClick($oForm2, '/iFolder/adminconsole/buttons/btndisplay_en.gif', 'src') $oTable = _IETableGetCollection($oFrame, 1) ConsoleWrite('IsObj($oTable) = ' & IsObj($oTable) & ' ObjName = ' & String(ObjName($oTable)) & ' $oTable.type = ' & $oTable.type & @CRLF) $aReport = _IETableWriteToArray($oTable, True) _ArrayDisplay($aReport) ; _IEQuit ($oIE) EndFunc ;==>GetReport Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
DW1 Posted September 17, 2013 Share Posted September 17, 2013 Have you tried an _IELoadWait() after each click as suggested previously? If that doesn't work, then looping until a specific element exists is a good method. The sleep is just not reliable for this. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
mLipok Posted September 17, 2013 Share Posted September 17, 2013 I do not know the exact content of the website, but I've been wondering about this record may instead: Local $ oForm2 = _IEFormGetCollection ($oFrame, 0) you should use: Local $ oForm2 = _IEFormGetCollection ($oFrame2, 0) Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 17, 2013 Author Share Posted September 17, 2013 Have you tried an _IELoadWait() after each click as suggested previously? If that doesn't work, then looping until a specific element exists is a good method. The sleep is just not reliable for this. Yes, tried that.It's the _IELoadWait() function that returns the error. Besides can you describe what website do when you click _IELinkClickByText($oIE, 'Continue to this website (not recommended).') _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') _IELinkClickByText($oFrame2, 'User Accounts') _IEFormImageClick($oForm2, '/iFolder/adminconsole/buttons/btndisplay_en.gif', 'src') Yes, The user account is authenticated, the contents of "NAVFRAME" are changed to give links to different reports and the contents of "MAINFRAME" are changed to a table of summary statistics. This loads correctly but the script just exits. try this: expandcollapse popup#include <IE.au3> #include <Array.au3> #include <File.au3> Global $aSites Global $SiteFile = '\\hccarchive02\vol1\logs\if_mig\sites.txt' Global $Username = InputBox('iFolder Server Reports', 'Please enter the iFolder admin account User name', '') Global $Password = InputBox('iFolder Server Reports', 'Please enter the password for the iFolder admin account', '', '*') _FileReadToArray($SiteFile, $aSites) For $i = 1 To $aSites[0] GetReport($aSites[$i]) ; More Stuff Next Func GetReport($Site) $oIE = _IECreate('https://ifolder.' & $Site & '.hertscc.gov.uk/iFolderServer/Admin/Reporting.htm', 0, 1, 1) _IELinkClickByText($oIE, 'Continue to this website (not recommended).') Local $oFrame = _IEFrameGetObjByName($oIE, 'MAINFRAME') ConsoleWrite('IsObj($oFrame) = ' & IsObj($oFrame) & ' ObjName = ' & String(ObjName($oFrame)) & ' Obj.type = ' & $Obj.type & @CRLF) Local $oForm = _IEFormGetCollection($oFrame, 0) ConsoleWrite('IsObj($oForm) = ' & IsObj($oForm) & ' ObjName = ' & String(ObjName($oIE)) & ' $oIE.type = ' & $oIE.type & @CRLF) Local $oUsername = _IEFormElementGetObjByName($oForm, "User") ConsoleWrite('IsObj($oUsername) = ' & IsObj($oUsername) & ' ObjName = ' & String(ObjName($oUsername)) & ' $oUsername.type = ' & $oUsername.type & @CRLF) Local $oPassword = _IEFormElementGetObjByName($oForm, 'Password') ConsoleWrite('IsObj($oPassword) = ' & IsObj($oPassword) & ' ObjName = ' & String(ObjName($oPassword)) & ' $oPassword.type = ' & $oPassword.type & @CRLF) _IEFormElementSetValue($oUsername, $Username, 1) _IEFormElementSetValue($oPassword, $Password, 1) _IEFormImageClick($oForm, '/iFolder/adminconsole/buttons/btnlogin_en.gif', 'src') sleep(2000) Local $oFrame2 = _IEFrameGetObjByName($oIE, 'NAVFRAME') ConsoleWrite('IsObj($oFrame2) = ' & IsObj($oFrame2) & ' ObjName = ' & String(ObjName($oFrame2)) & ' $oFrame2.type = ' & $oFrame2.type & @CRLF) _IELinkClickByText($oFrame2, 'User Accounts') Sleep(500) Local $oForm2 = _IEFormGetCollection($oFrame, 0) ConsoleWrite('IsObj($oForm2) = ' & IsObj($oForm2) & ' ObjName = ' & String(ObjName($oForm2)) & ' $oForm2.type = ' & $oForm2.type & @CRLF) _IEFormImageClick($oForm2, '/iFolder/adminconsole/buttons/btndisplay_en.gif', 'src') $oTable = _IETableGetCollection($oFrame, 1) ConsoleWrite('IsObj($oTable) = ' & IsObj($oTable) & ' ObjName = ' & String(ObjName($oTable)) & ' $oTable.type = ' & $oTable.type & @CRLF) $aReport = _IETableWriteToArray($oTable, True) _ArrayDisplay($aReport) ; _IEQuit ($oIE) EndFunc ;==>GetReport Just tried it and it errors at the first ConsoleWrite. I'll look at this more closely but it may be in the morning. Link to comment Share on other sites More sharing options...
mLipok Posted September 17, 2013 Share Posted September 17, 2013 maybe because I change this Local $oForm = _IEFormGetObjByName($oFrame, 'mainform') to this: Local $oForm = _IEFormGetCollection($oFrame, 0) change it back in my example and try again. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Speleologist Posted September 18, 2013 Author Share Posted September 18, 2013 OK, that gets it moving. It now fails at the same point as before. Console output below: >"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Documents and Settings\Robin Sermon\My Documents\ZenIssues\temp.au3" /UserParams +>09:13:17 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0409 Keyboard:00000809 OS:WIN_XP/Service Pack 3 CPU:X64 OS:X86) >Running AU3Check (1.54.22.0) from:C:\Program Files\AutoIt3 +>09:13:17 AU3Check ended.rc:0 >Running:(3.3.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Documents and Settings\Robin Sermon\My Documents\ZenIssues\temp.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop IsObj($oFrame) = 1 ObjName = HTMLWindow2 oFrame.type = HTML Document IsObj($oForm) = 1 ObjName = IWebBrowser2 $oIE.type = HTML Document IsObj($oUsername) = 1 ObjName = HTMLInputElement $oUsername.type = text IsObj($oPassword) = 1 ObjName = HTMLInputElement $oPassword.type = password C:\Program Files\AutoIt3\Include\IE.au3 (638) : ==> The requested action with this object has failed.: While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top.document.readyState = 4 Or $f_Abort) While Not (String($oTemp.top.document.readyState) = "complete" Or $o_object.top^ ERROR ->09:13:29 AutoIt3.exe ended.rc:1 >Exit code: 1 Time: 12.386 To my untutored eye, the objects are all OK, but it still fails inside the UDF. 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