Jump to content

Vieri

Active Members
  • Posts

    31
  • Joined

  • Last visited

Vieri's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Just a last question regarding this issue. I'd like to use _IECreate whenever possible and only if it fails should I use the hack in my previous post. Is this possible? I can't seem to make it work. I'm pasting the code below. How should I write the "MyErrFunc" function? Even if I set $IE_failed = True in that function and do a "return", it seems to go into an infinite loop and I never get to the part where I should "ShellExecute". _IEErrorHandlerRegister("MyErrFunc") $IE_failed = False $oIE = _IECreate ($URL, 0, 0, 1) If $IE_failed = True Then ShellExecute(@ProgramFilesDir & "Internet Exploreriexplore.exe", $URL, "", "", "@SW_HIDE") If WinWait("HMAN intranet login", "", 30) = 0 Then Exit(1) EndIf $oIE = _IEAttach("HMAN intranet login") EndIf
  2. This is my new source code now: #include <IE.au3> _IEErrorHandlerRegister() ShellExecute(@ProgramFilesDir & "Internet Exploreriexplore.exe", "http://10.215.144.66/temp/index_login.html", "", "", "@SW_HIDE") If WinWait("HMAN intranet login", "", 30) = 0 Then Exit(1) EndIf $oIE = _IEAttach("HMAN intranet login") $oForm = _IEFormGetObjByName ($oIE, "form1") $oQuery = _IEFormElementGetObjByName ($oForm, "user") _IEFormElementSetValue ($oQuery, $UserName) $oQuery = _IEFormElementGetObjByName ($oForm, "password") _IEFormElementSetValue ($oQuery, $UserPWD) _IEFormSubmit ($oForm, 0) _IELoadWait($oIE) $hwnd = _IEPropertyGet($oIE, "hwnd") WinSetState($hwnd, "", @SW_MINIMIZE) WinSetState($hwnd, "", @SW_SHOW) It's a bit of a hack and certainly not as neat as using _IECreate but it does solve my issue without touching each user's IE8 settings. Thanks
  3. It seems to be because in my au3 script I'm calling http://10.215.144.66/temp/index_login.html and index_login.html has a "post action" pointing to a hostname www.hman.local. In fact, if I replace www.hman.local with it's IP address, I don't get the error anymore. But I still don't see why _IECreate should choke on this.
  4. It's a simple HTML page. Very basic form. No Ajax, nothing. Just need to load the form. In the test source code posted above, I'm not even "post"ing yet. Here's the HTML source of index_login.html: <html> <body> <table width="100%" border="0" height="90%"> <tr> <td valign="top" width="120" bgcolor="#CCCCCC" height="100%"> <div align="right"> <form name="form1" id="form1" method="post" action="https://www.hman.local/apps/portal/index.php3"> <table border="0" bordercolor="#003399" width="100%" cellspacing="0" cellpadding="0"> <tr bgcolor="#003399"> <td colspan="2"> User </td> </tr> <tr> <td> <br>&#160;User </td> <td> <br><input type="text" name="user" id="user"> </td> </tr> <tr> <td> &#160;Password </td> <td> <input type="password" name="password" id="password"> </td> </tr> <tr> <td align="right" colspan="2"> <input type="submit" name="btsubmit" value="Enter"> </td> </tr> </table> </form> </div> </td> </tr> </table> </body> </html>
  5. Here's the console message: >"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "Z:AutoITautologinintranetWin_2K_XPIE6zzz_forum_test2.au3" --> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidObjectType >Exit code: 0 Time: 1.027 and here's the source code: #include <IE.au3> _IEErrorHandlerRegister() $oIE = _IECreate("http://10.215.144.66/temp/index_login.html")
  6. As you can see below, I'm not getting more information if I run the code within the editor... Just 3 lines of code. Am I doing something wrong? I can send you a screenshot:if you wish. The code: #include <IE.au3> $oIE = _IECreate("http://10.215.144.66/temp/index_login.html") _IEErrorHandlerRegister() The console: >"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "Z:AutoITautologinintranetWin_2K_XPIE6zzz_forum_test2.au3" C:\Program Files\AutoIt3\Include\IE.au3 (560) : ==> The requested action with this object has failed.: WEnd WEnd^ ERROR >Exit code: 1 Time: 1.426
  7. So THAT'S the console you were referring to. OK, will do. Bear with me please. I'll try that on Monday from work. Thanks
  8. Why do you say that? And what "console" are you referring to? If you want I can post screenshots of the popup windows that actually show these error messages but that won't change anything really. Those are the only messages that AutoIT shows via GUI boxes. Just like in my first post. As far as the error handler is concerned, I read the AutoIT help file stating that: "[optional] String variable with the name of a user-defined COM error handler, defaults to the internal COM error handler in this UDF" However, running your code (exactly as you posted it, but obviously removing the HTML trash this forum has inserted into it) on my machine doesn't show any messages from the "internal COM error handler in the UDF". Instead, it shows popup msgboxes with any one of the 3 messages I posted above. By the way, just in case you're wondering, I uninstalled a previous AutoIT version before installing the latest. So I'm pretty sure my IE.au3 is sane.
  9. I actually DID run it (with "protected mode" disabled) and got the following error messages (yes, randomly....): Line 625 (File "C:\Program Files\AutoIt3\Include\IE.au3"); $oTemp = $o_object.document.parentWindow $oTemp = $o_object.document^ ERROR Error: The requested action with this object has failed. ----- same as "message 2" in post 1. ---- Line 549 (File "C:\Program Files\AutoIt3\Include\IE.au3"); While Not (String($o_object.readyState) = "complete" Or %o_object.readyState = 4 Or $f_Abort) While Not (String($o_object.readyState) = "complete" Or %o_object.readyState ^ ERROR Error: The requested action with this object has failed. In other words, 3 different error messages with the same AutoIT code (your code). If I enable "protected mode", all's fine (no error messages and the script runs fine).
  10. By the way, I don't know why enabling or disabling "protected mode" should actually make a difference as far as opening a simple web page (no activeX, no nothing), but it does with autoit's IECreate.
  11. It looks like it has something to do with IE8's security settings. Since I'm trying to _IECreate an intranet web page, the browser is opened with the setting "Protected mode: disabled". If I enable "protected mode" for the "local network" then the AuotIT script works as expected... So I have another problem now: how do I make sure that the IE browser has "protected mode" enabled for the intranet zone before calling _IECreate()? Or can IE.au3 do that for me? Better yet, make _IECreate work even if IE8 has "protected mode" disabled.
  12. There's no such line... My script is the one posted above (just 9 lines of code). Line 560 probably refers to the included IE.au3 file.
  13. Thanks Dale, I added the following to the above code example: _IEErrorHandlerRegister("MyErrFunc") Func MyErrFunc() ; Important: the error object variable MUST be named $oIEErrorHandler Local $ErrorScriptline = $oIEErrorHandler.scriptline Local $ErrorNumber = $oIEErrorHandler.number Local $ErrorNumberHex = Hex($oIEErrorHandler.number, 8) Local $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2) Local $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2) Local $ErrorSource = $oIEErrorHandler.Source Local $ErrorHelpFile = $oIEErrorHandler.HelpFile Local $ErrorHelpContext = $oIEErrorHandler.HelpContext Local $ErrorLastDllError = $oIEErrorHandler.LastDllError Local $ErrorOutput = "" $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError MsgBox(0, "COM Error", $ErrorOutput) SetError(1) Return EndFunc ;==>MyErrFunc When I run the script I get the following message, over and over again: --> COM Error Encountered in script.au3 ----> $ErrorScriptline = 560 ----> $ErrorNumberHex = 800706B5 ----> $ErrorNumber = -2147023179 ----> $ErrorWinDescription = Unknown interface. ----> $ErrorDescription = ----> $ErrorSource = ----> $ErrorHelpFile = ----> $ErrorHelpContext = 0 ----> $ErrorLastDllError = 0 I don't know how to interpret the error message "unknown interface". Thanks
  14. Each time I run the Autoit script below, I get any of the following 2 error messages: message 1: Line 1124 AutoIt3\Include\IE.au3: Local $o_col = $o_object.document.forms.item($s_Name) Local $o_col = $o_object.document^ ERROR Error: The requested action with this object has failed. message 2: Line 560 AutoIt3\Include\IE.au3: WEnd WEnd^ ERROR Error: The requested action with this object has failed. AutoIt Version: 3.3.8.1 Windows 7 IE 8 Autoit script: #include <IE.au3> $oIE = _IECreate("http://10.215.144.66/apps/portal/index_login.php") $oForm = _IEFormGetObjByName($oIE, "form1") $oUser = _IEFormElementGetObjByName($oForm, "user") $oPasswd = _IEFormElementGetObjByName($oForm, "password") $user = "user" $passwd = "password" _IEFormElementSetValue($oUser, $user) _IEFormElementSetValue($oPasswd, $passwd) LAN web page ("http://10.215.144.66/apps/portal/index_login.php"): <html> <body> <table width="100%" border="0" height="90%"> <tr> <td valign="top" width="120" bgcolor="#CCCCCC" height="100%"> <div align="right"> <form name="form1" id="form1" method="post" action="https://webapps.domain.org/apps/portal/index.php"> <table border="0" bordercolor="#003399" width="100%" cellspacing="0" cellpadding="0"> <tr bgcolor="#003399"> <td colspan="2"> User </td> </tr> <tr> <td> <br>&#160;User </td> <td> <br><input type="text" name="user" id="user"> </td> </tr> <tr> <td> &#160;Password </td> <td> <input type="password" name="password" id="password"> </td> </tr> <tr> <td align="right" colspan="2"> <input type="submit" name="btsubmit" value="Enter"> </td> </tr> </table> </form> </div> </td> </tr> </table> </body> </html> Any ideas? Thanks Vieri
  15. Hi, I'm having trouble embedding an IE object within an AutoIT GUI. The code snippet below works fine for me when using a screen resolution of 1024x768. However, if I change the desktop resolution to 800x600 and reboot, @DesktopWidth, @DesktopHeight are as expected (ie. 800, 600) but the IE embedded object displays HTML pages that seem to be for another resolution (seems to be for bigger resolutions because the "drawing area" is bigger). I think you can easily reproduce the problem by setting your display to 800x600 and running on one hand a normal IE instance pointing to a url (either using IECreate or opening the browser directly), and on the other, the following script: #include <IE.au3> $oIE = _IECreateEmbedded () $GUIhandle = GUICreate("window title", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP, $WS_EX_OVERLAPPEDWINDOW) $GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, @DesktopWidth, @DesktopHeight) GUISetState() _IENavigate ($oIE, $URL) If the URL code is appropriate you should notice the difference. IE embedded will cut off a piece of the page that you will be able to see correctly in the normal IE instance. How can I fix this? Is there a way to tell $oIE to use 800x600? Thanks
×
×
  • Create New...