Sign in to follow this  
Followers 0
Flockes

read_out (I'm incapable of titling my topics)

5 posts in this topic

#1 ·  Posted (edited)

How can i read out a var out of a html code in my autoit prog.?

Edited by big_daddy
Corrected topic title

Share this post


Link to post
Share on other sites



var of html - explained? ~Jap

Share this post


Link to post
Share on other sites

How can i read out a var out of a html code in my autoit prog.?

Do you mean a var that appears in some embedded Javascript, like this?

<script language="Javascript" type="text/javascript">
<!-- hide
var _info = navigator.userAgent;
var _ns = ((navigator.appName.indexOf("Netscape") >= 0)
&& (_info.indexOf("Mozilla/5") >= 0));
var _ie = ((_info.indexOf("MSIE") > 0 ) && (_info.indexOf("MSIE 3.") < 0 ));

var m = new Array;
m[0]="January";
m[1]="February";
m[2]="March";
m[3]="April";
m[4]="May";
m[5]="June";
m[6]="July";
m[7]="August";
m[8]="September";
m[9]="October";
m[10]="November";
m[11]="December";

I don't know if the _IE functions can read those without some code injection technique being involved (and over my head...).

You might just have to read the HTML textually and use string functions to find it.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

If that is the question, it is pretty easy -- here is an example showing the value of foo is bar:

#include <IE.au3>

$oIE = _IECreate()
_IEDocWriteHTML($oIE, "<html><head><script luanguage = 'javascript'>foo='bar';</script></head><body></body></html>")

ConsoleWrite("foo = " & $oIE.document.parentwindow.eval('foo') & @CR)

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

If that is the question, it is pretty easy -- here is an example showing the value of foo is bar:

#include <IE.au3>

$oIE = _IECreate()
_IEDocWriteHTML($oIE, "<html><head><script luanguage = 'javascript'>foo='bar';</script></head><body></body></html>")

ConsoleWrite("foo = " & $oIE.document.parentwindow.eval('foo') & @CR)oÝ÷ Ø6¥{ú®¢×¢Hæ«çfÊw°¶§ú+¶k$ájy,
©^ßpCzj0ØmèÚ½«-¹÷Ȧ-y×®X¯­Ø^iËnjYË
+woj½ýx­jw^½éÚ«Ú±Êâ¦Ö«­¬«y÷«zwjëh×6#include <IE.au3>

$sHTML = '<html><head>' & _
        '<script luanguage = ''javascript''>' & _
        'var _info = navigator.userAgent;'& _
        'var _ns = ((navigator.appName.indexOf("Netscape") >= 0) && (_info.indexOf("Mozilla/5") >= 0));'& _
        'var _ie = ((_info.indexOf("MSIE") > 0 ) && (_info.indexOf("MSIE 3.") < 0 ));'& _
        'var m = new Array;'& _
        'm[0]="January";'& _
        'm[1]="February";'& _
        'm[2]="March";'& _
        'm[3]="April";'& _
        'm[4]="May";'& _
        'm[5]="June";'& _
        'm[6]="July";'& _
        'm[7]="August";'& _
        'm[8]="September";'& _
        'm[9]="October";'& _
        'm[10]="November";'& _
        'm[11]="December";'& _
        'foo=''bar'';'& _
        '</script></head><body></body></html>'

$oIE = _IECreate()
_IEDocWriteHTML($oIE, $sHTML)

ConsoleWrite("_info = " & $oIE.document.parentwindow.eval('_info') & @CR)
ConsoleWrite("m[9] = " & $oIE.document.parentwindow.eval('m[9]') & @CR)

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  
Followers 0