Jump to content

How to send input into browser


Recommended Posts

I want to make simple browser & Some keystroke inside

i get from this example then adding some keystroke, but it wont send any key.

how to send input into the browser

Local $oIE, $GUIActiveX
Local $GUI_Button_A, $GUI_Button_B, $GUI_Button_C, $GUI_Button_B
$oIE = ObjCreate("Shell.Explorer.2")

    GUICreate("Embedded Web control Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN))
    $GUIActiveX = GUICtrlCreateObj ($oIE, 10, 40, 600, 360)
$GUI_Button_A = GUICtrlCreateButton("A", 10, 450, 100, 30)
$GUI_Button_B = GUICtrlCreateButton("B", 120, 450, 100, 30)
$GUI_Button_C = GUICtrlCreateButton("C", 230, 450, 100, 30)
 GUISetState()       ;Show GUI

    $oIE.navigate("www.google.com")

 While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $GUI_Button_A
                Send ("a")
            Case $msg = $GUI_Button_A
                Send ("b")
            Case $msg = $GUI_Button_A
                Send ("c")
        EndSelect

    WEnd

 

Link to comment
Share on other sites

This might be a way to do it:

#include <IE.au3>

$oIE = _IECreateEmbedded()

$hMain = GUICreate("Embedded Web control Test", 800, 600)
$GUIActiveX = GUICtrlCreateObj ($oIE, 0, 0, 800, 360)
$GUI_Button_A = GUICtrlCreateButton("A", 10, 450, 100, 30)
$GUI_Button_B = GUICtrlCreateButton("B", 120, 450, 100, 30)
$GUI_Button_C = GUICtrlCreateButton("C", 230, 450, 100, 30)
GUISetState(@SW_SHOW,$hMain)

_IENavigate($oIE,"www.google.com")
Global $oInput = _IEGetObjById($oIE,'lst-ib')

 While True
   Switch GUIGetMsg()
      Case -3   ;$GUI_EVENT_CLOSE
         ExitLoop
      Case $GUI_Button_A
         SendKey('a')
      Case $GUI_Button_B
         SendKey('b')
      Case $GUI_Button_C
         SendKey('c')
   EndSwitch
   Sleep(10)
WEnd

Func SendKey($Key)
   Local $CurrentValue = _IEFormElementGetValue($oInput)
   _IEFormElementSetValue($oInput, $CurrentValue & $Key)
EndFunc

 

When the words fail... music speaks.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...