Jump to content

Recommended Posts

Posted (edited)

<script>

var a=1

</script>

I have this script.

How to set a value to 123 by using autoit script.

thanks

Edited by taren9k3
Posted (edited)

#include <IE.au3>

Dim $oIE, $oScripts, $oScript

$oIE = _IECreate('http://www.google.com/')
ConsoleWrite('a variable is: ' & IEEval($oIE, 'a') & @LF)
;$oScript = $oIE.document.scripts(2)
;ConsoleWrite(_IEPropertyGet($oScript, 'innerhtml') & @LF)
;IEEval($oScript, 'a=123')
IEEval($oIE, 'a=123')
ConsoleWrite('a variable is: ' & IEEval($oIE, 'a') & @LF)

; Thanks DaleHohm for the code.
Func IEEval($o_object, $s_eval)
    Return $o_object.document.parentwindow.eval($s_eval)
EndFunc   ;==>IEEval

Edited by Authenticity
Posted

Hi, heh sorry for not replying here. I didn't know about it, it's from another thread the DaleHohm posted. It's not documented here yet but I believe that the Window object exposes it as well as the execScript method which, if I understand it correctly, does the same as eval.

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
  • Recently Browsing   0 members

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