Jump to content

Notify AutoIt that JScript function in embedded web page returned


EKY32
 Share

Recommended Posts

hey friends,

I have a web page loaded to an embedded browser in a GUI, I  was thinking if there is a way that AutoIt can get notified when a jscript function returns:

Simple code for fast test:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$oIE = ObjCreate("Shell.Explorer.2")
GUICreate("JS + AU3", 500, 200)
GUICtrlCreateObj($oIE, 10, 40, 400, 100)
GUISetState()

$oIE.navigate(@ScriptDir & "\jsau3.html")

While 1
    $msg = GUIGetMsg()

    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop

    EndSelect
WEnd

Func Command()
    MsgBox(0,"","Hi From AU3")
EndFunc

Simple HTML file with jScript functions: (jsau3.html)

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Untitled 1</title>
<script>function Browser() {alert("Hi From JS")};</script>
<script>function AutoIt() {//Send Command To AutoIt};</script>
</head>

<body>

<form method="post">
    <input name="Button1" type="button" value="Send JS MsgBox To Browser" onclick="Browser()" />
    <br/>
    <input name="Button2" type="button" value="Send Command To AutoIt" onclick="AutoIt()" /></form>
</body>

</html>

Button2 should notify AutoIt to run Function "Command()" if this is possible somehow.

thank you.

Edited by EKY32

[font="'trebuchet ms', helvetica, sans-serif;"]Please mark the answer of your question if you found it.[/font]

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...