Jump to content
Sign in to follow this  
HoangQuandlk

Problem with controlclick (). The next command is not executed

Recommended Posts

HoangQuandlk

Hi,
I have a problem using the controlclick () function. Here is my code:

; Trap COM errors so that 'Back' and 'Forward'
; outside of history bounds does not abort script
; (expect COM errors to be sent to the console)

#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
#include "IE_EmbeddedVersioning.au3"

_IE_EmbeddedSetBrowserEmulation(-1, True, True)
Local $oIE = _IECreateEmbedded()
GUICreate("Embedded Web control Test", 640, 580, _
        (@DesktopWidth) / 2, (@DesktopHeight) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN)
GUICtrlCreateObj($oIE, 10, 40, 600, 360)
Local $idButton_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
Local $idButton_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
Local $idButton_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
Local $idButton_Stop = GUICtrlCreateButton("Stop", 340, 420, 100, 30)

Global $g_idError_Message = GUICtrlCreateLabel("", 100, 500, 500, 30)
GUICtrlSetColor(-1, 0xff0000)

GUISetState(@SW_SHOW) ;Show GUI

_IENavigate($oIE, "http://www.autoitscript.com")
_IEAction($oIE, "stop")



; Waiting for user to close the window
While 1
    Local $iMsg = GUIGetMsg()
    Select
        Case $iMsg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $iMsg = $idButton_Home
            _IENavigate($oIE, "google.com")
            _IELoadWait($oIE)
            
            
            ; Right click the first time X:150
            ControlClick("Embedded Web control Test","","[CLASS:Internet Explorer_Server; INSTANCE:1]","right",1,150,250)
            Sleep(2000)
            ;Right click the second time X:250
            ControlClick("Embedded Web control Test","","[CLASS:Internet Explorer_Server; INSTANCE:1]","right",1,250,250)
            Sleep(2000)
            ;Right click the third time X:350
            ControlClick("Embedded Web control Test","","[CLASS:Internet Explorer_Server; INSTANCE:1]","right",1,350,250)
            CheckError("Home", @error, @extended)
            
            
            
        Case $iMsg = $idButton_Back
            _IEAction($oIE, "back")
            CheckError("Back", @error, @extended)
        Case $iMsg = $idButton_Forward
            _IEAction($oIE, "forward")
            CheckError("Forward", @error, @extended)
        Case $iMsg = $idButton_Stop
            _IEAction($oIE, "stop")
            CheckError("Stop", @error, @extended)
    EndSelect
WEnd

GUIDelete()

Exit

Func CheckError($sMsg, $iError, $iExtended)
    If $iError Then
        $sMsg = "Error using " & $sMsg & " button (" & $iExtended & ")"
    Else
        $sMsg = ""
    EndIf
    GUICtrlSetData($g_idError_Message, $sMsg)
EndFunc   ;==>CheckError

It should have been done with "Right click the second time X:250" and "Right click the third time X:350" after the completion of "Right click the first time X:150". But it is not.
I do not understand why.

My English ability is not very good. Sorry if this makes you feel uncomfortable. Thank for help me :).

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  

×