Jump to content
Sign in to follow this  
davidho

Mouse coordinates offset issue on IE11

Recommended Posts

5 hours ago, davidho said:

your console output from post#16 provide more detail. is there any setting  ?

Try to upgrade SciTE with this links:

https://www.autoitscript.com/site/autoit-script-editor/downloads/

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
Share on other sites
Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "F:\test.au3" /UserParams   
+>10:07:08 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper
>Running AU3Check (3.3.14.2)  params:-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7  from:C:\Program Files (x86)\AutoIt3  input:F:\test.au3
+>10:07:08 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\test.au3"   
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (lnkHeaderLogout)
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1899) : ==> The requested action with this object has failed.:
If IsObj($oObject.document.getElementById($sID)) Then
If IsObj($oObject.document^ ERROR
->10:07:35 AutoIt3.exe ended.rc:1
+>10:07:35 AutoIt3Wrapper Finished.
>Exit code: 1    Time: 27.75

rerun the script with latest version of SciTE4AutoIt3 dated 20-9-2015

Share this post


Link to post
Share on other sites
On 6.02.2015 at 3:44 AM, davidho said:

I have been using autoit (V3.3.12.0) on IE10 with Win 7 for the past 6 months and it really a great experience.
Recently, I have upgraded my PC to IE11 with windows update on win 7 and existing autoit script  below not able to locate the field or button correctly.

Try again with AutoIt 3.3.12.0 on your current PC with IE11.

But this is really strange as I was test it before on Win7 with IE11 on AutoIt 3.3.14.2 and I do not get any serious error.

even now on Win10
 

Quote

>"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "Z:\TOOLs\Macro\PROGRAMY\__TEST\IE_TEST_167295.au3" /UserParams    
+>08:26:41 Starting AutoIt3Wrapper v.15.920.938.4 SciTE v.3.6.2.0   Keyboard:00000415  OS:WIN_10/  CPU:X64 OS:X64  Environment(Language:0415)  CodePage:65001  utf8.auto.check:4    # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => C:\Users\user\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => C:\Users\user\AppData\Local\AutoIt v3\SciTE 
>Running AU3Check (3.3.14.2)  params:-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7  from:C:\Program Files (x86)\AutoIt3  input:Z:\TOOLs\Macro\PROGRAMY\__TEST\IE_TEST_167295.au3
+>08:26:41 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "Z:\TOOLs\Macro\PROGRAMY\__TEST\IE_TEST_167295.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (lnkHeaderLogout)
+>08:26:52 AutoIt3.exe ended.rc:0
+>08:26:52 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 12.02

 

QUESTIONS:
Do you have added this site to compability mode ?
Do you have added this site to trusted zone ?

Try to play with it.

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
Share on other sites
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7

#include <IE.au3>
#include <Array.au3>

_Example()
Func _Example()
    Local $oIE = _IECreate('http://x3demob.cpx3demo.com:2082')
    Local $oIE_UserName = _IEGetObjById($oIE, "user")
    Local $oIE_password = _IEGetObjById($oIE, "pass")
    Local $oIE_login_submit = _IEGetObjById($oIE, "login_submit")
    _IEFormElementSetValue($oIE_UserName, 'demo')
    _IEFormElementSetValue($oIE_password, 'demo')
    _IEAction($oIE_login_submit, 'click')
    _IELoadWait($oIE)

    Local $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
    If @error Then
        _IEErrorNotify(False)
        While Sleep(50)
            $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
            If Not @error Then ExitLoop
            MsgBox(1, "test", "test") ; work fine after insert this line
            ; sleep(5000) ; will faield without MsgBox above
        WEnd
        _IEErrorNotify(True)
    EndIf

    Local $oTag_coll = _IETagNameGetCollection($oIE, 'a')
    If Not @error Then
        Local $aTag_Content[1]
        For $oTag_enum In $oTag_coll
            ReDim $aTag_Content[UBound($aTag_Content) + 1]
            $aTag_Content[UBound($aTag_Content) - 1] = _IEPropertyGet($oTag_enum, 'outerhtml')
        Next
        $aTag_Content[0] = UBound($aTag_Content)
        _ArrayDisplay($aTag_Content, "Array of Tag Contents")
    EndIf

    _IEAction($oIE_LogutButton, 'click')
    _IELoadWait($oIE)

EndFunc    ;==>_Example

I tried out all suggestion in your last posting but all failed to work on IE11.

But I managed to make your code work on IE11 by inserting MsgBox as shown in source code above without knowing why.

After I click "OK" on the message box, the script managed to locate "logout' button and then logout successfully.

I also tried to replace it with sleep(5000) but still failed.

I guess this might require user "click" event to trigger it........could you able to find out the reason ?  any work around ?

please let me know if there anything I can help ....I'm clueless

 

Share this post


Link to post
Share on other sites

any idea what causing it ?  still encountered this issue on IE11

"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1899) : ==> The requested action with this object has failed.:
If IsObj($oObject.document.getElementById($sID)) Then
If IsObj($oObject.document^ ERROR

Share this post


Link to post
Share on other sites
On 10.02.2016 at 8:31 AM, mLipok said:

QUESTIONS:
Do you have added this site to compability mode ?
Do you have added this site to trusted zone ?

Try to play with it.

Did you try ?

 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
Share on other sites

Yes, I did try out both setting

after added this site to compatibility mode,  the script still cannot locate the logout field but work fine by including MsgBox. (same as before)

after added this site to trusted zone, error below appeared

--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147417848, Browser has been deleted prior to operation.)
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IEAction(click), $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_InvalidObjectType ()
--> IE.au3 T3.0-2 Error from function _IEGetObById, $_IESTATUS_InvalidObjectType

Share this post


Link to post
Share on other sites

maybe like this:

;~ https://www.autoitscript.com/forum/topic/167295-mouse-coordinates-offset-issue-on-ie11/?page=2#comment-1296760

#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7

#include <IE.au3>
#include <Array.au3>

_Example()
Func _Example()
    Local $oIE = _IECreate('http://x3demob.cpx3demo.com:2082')
    Local $oIE_UserName = _IEGetObjById($oIE, "user")
    Local $oIE_password = _IEGetObjById($oIE, "pass")
    Local $oIE_login_submit = _IEGetObjById($oIE, "login_submit")
    _IEFormElementSetValue($oIE_UserName, 'demo')
    _IEFormElementSetValue($oIE_password, 'demo')
    _IEAction($oIE_login_submit, 'click')
    _IELoadWait($oIE)

    Local $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
    If @error Then
        _IEErrorNotify(False)
        Sleep(1000)
        Local $sHTML = ''
        While Sleep(100)
            $sHTML = _IEDocReadHTML($oIE)
            If @error Then ContinueLoop
            If StringInStr($sHTML,'lnkHeaderLogout') < 0 Then ContinueLoop

            $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
            If Not @error Then ExitLoop
            ; MsgBox(1, "test", "test") ; work fine after insert this line
            ; sleep(5000) ; will faield without MsgBox above
        WEnd
        _IEErrorNotify(True)
    EndIf

    Local $oTag_coll = _IETagNameGetCollection($oIE, 'a')
    If Not @error Then
        Local $aTag_Content[1]
        For $oTag_enum In $oTag_coll
            ReDim $aTag_Content[UBound($aTag_Content) + 1]
            $aTag_Content[UBound($aTag_Content) - 1] = _IEPropertyGet($oTag_enum, 'outerhtml')
        Next
        $aTag_Content[0] = UBound($aTag_Content)
        _ArrayDisplay($aTag_Content, "Array of Tag Contents")
    EndIf

    _IEAction($oIE_LogutButton, 'click')
    _IELoadWait($oIE)

EndFunc    ;==>_Example

 

??
 


Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
Share on other sites

I was so intrigued by why it works for me and not with you, that I forgot to add something to the script (COM error handling)

;~ https://www.autoitscript.com/forum/topic/167295-mouse-coordinates-offset-issue-on-ie11/?page=2#comment-1296760
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7


#include <IE.au3>
#include <Array.au3>

_IEErrorHandlerRegister(_User_ErrFunc)


_Example()
Func _Example()
    Local $oIE = _IECreate('http://x3demob.cpx3demo.com:2082')
    Local $oIE_UserName = _IEGetObjById($oIE, "user")
    Local $oIE_password = _IEGetObjById($oIE, "pass")
    Local $oIE_login_submit = _IEGetObjById($oIE, "login_submit")
    _IEFormElementSetValue($oIE_UserName, 'demo')
    _IEFormElementSetValue($oIE_password, 'demo')
    _IEAction($oIE_login_submit, 'click')
    _IELoadWait($oIE)

    Local $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
    If @error Then
        _IEErrorNotify(False)
        Sleep(1000)
        Local $sHTML = ''
        While Sleep(100)
            $sHTML = _IEDocReadHTML($oIE)
            If @error Then ContinueLoop
            If StringInStr($sHTML,'lnkHeaderLogout') < 0 Then ContinueLoop

            $oIE_LogutButton = _IEGetObjById($oIE, 'lnkHeaderLogout')
            If Not @error Then ExitLoop
            ; MsgBox(1, "test", "test") ; work fine after insert this line
            ; sleep(5000) ; will faield without MsgBox above
        WEnd
        _IEErrorNotify(True)
    EndIf

    Local $oTag_coll = _IETagNameGetCollection($oIE, 'a')
    If Not @error Then
        Local $aTag_Content[1]
        For $oTag_enum In $oTag_coll
            ReDim $aTag_Content[UBound($aTag_Content) + 1]
            $aTag_Content[UBound($aTag_Content) - 1] = _IEPropertyGet($oTag_enum, 'outerhtml')
        Next
        $aTag_Content[0] = UBound($aTag_Content)
        _ArrayDisplay($aTag_Content, "Array of Tag Contents")
    EndIf

    _IEAction($oIE_LogutButton, 'click')
    _IELoadWait($oIE)

EndFunc    ;==>_Example

; User's COM error function.
; After SetUp with ObjEvent("AutoIt.Error", ....) will be called if COM error occurs
Func _User_ErrFunc($oError)
    ; Do anything here.
    ConsoleWrite(@ScriptFullPath & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc   ;==>_User_ErrFunc

Check it now and show your console output.

btw.
you can also use 

_IELoadWait_ForAllFrames

from here:

 

 

 

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
Share on other sites

Each time I execute script in post#31, it will hang there (looping) until I close the browser and error below will appear

Quote

"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\autoit_installation\qqq.au3" /UserParams   
+>11:06:07 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0   Keyboard:00000409  OS:WIN_7/Service Pack 1  CPU:X64 OS:X64    Environment(Language:0409)
+>         SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE   UserDir => D:\Users\collector03\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE_USERHOME => D:\Users\collector03\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (3.3.14.2)  params:-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7  from:C:\Program Files (x86)\AutoIt3  input:D:\autoit_installation\qqq.au3
+>11:06:07 AU3Check ended.rc:0
>Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "D:\autoit_installation\qqq.au3"   
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-2 Warning from function _IEGetObjById, $_IESTATUS_NoMatch (lnkHeaderLogout)
D:\autoit_installation\qqq.au3 (1638) : ==> COM Error intercepted !
 err.number is:   0x80020009
 err.windescription: Exception occurred.

 err.description is:  
 err.source is:   
 err.helpfile is:  
 err.helpcontext is:  0
 err.lastdllerror is:  0
 err.scriptline is:  1638
 err.retcode is:  0x80004005

 the only work around is inserting MsgBox below

MsgBox(1, "test", "test", 3); will close msgbox after 3 sec timeout.

I think I will stick with this solution for the time being

thanks

David

Share this post


Link to post
Share on other sites

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
Include Dependency Tree (Tool for analyzing script relations)
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  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 APIErrorLog.au3 UDF - A logging Library *

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 * 

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

PDF Related:https://www.autoitscript.com/forum/topic/177368-how-to-get-reference-to-pdf-object-embeded-in-ie/ *

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 *

"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"
:naughty:  :ranting:, 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: 2020-09-20

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...