Flockes 0 Posted October 5, 2007 (edited) How can i read out a var out of a html code in my autoit prog.? Edited October 5, 2007 by big_daddy Corrected topic title Share this post Link to post Share on other sites
JBeef 0 Posted October 5, 2007 var of html - explained? ~Jap Share this post Link to post Share on other sites
PsaltyDS 41 Posted October 5, 2007 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
DaleHohm 65 Posted October 5, 2007 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, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe 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
PsaltyDS 41 Posted October 5, 2007 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½ýxjw^½éÚ«Ú±Êâ¦Ö«¬«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