Jump to content

Nodejs & htmlfile object


jugador
 Share

Recommended Posts

First thing first-> javascript I don't know.

But for fun thought if could manage to run basic javascript code in Autoit.
and using htmlfile object succeed 😅 in running javascript code.

Global $ObjErr = ObjEvent("AutoIt.Error", "__HtmlFileErrorHandler")

__Example_2()
Func __Example_2()
    Local $o_Obj = __HTMLFILEObjCreate()
    Local $JsObj = __HTMLObject($o_Obj)
    If Not IsObj($JsObj) Then Exit

    #cs
    Local $o_JsCode = '(function() {Display = function(a,b){return (a * b);};})();'
    $JsObj.execScript($o_JsCode)
    ConsoleWrite('Display -> ' & $JsObj.Display(5, 4) & @Crlf)
    #ce

    #cs
    Local $o_JsCode = 'if (typeof Car !== "object") {Car = {};}(function()' & _
    ' {Name = "BMW"; Color = "Black"; function Car.Display(){return (Name + " " + Color);}})();'
    $JsObj.execScript($o_JsCode)
    ConsoleWrite('Display -> ' & $JsObj.Car.Display('') & @Crlf)
    #ce

    #cs
    Local $o_JsCode = 'Car= function(){this.Name = ""; this.Color = ""; this.Display= function(){return this.Name + " " + this.Color}};'
    $JsObj.execScript($o_JsCode)
    $JsObj.execScript("var Car = new Car();")
    $JsObj.Car.Name = "BMW"
    $JsObj.Car.Color = "Red"
    ConsoleWrite('Car -> ' & ($JsObj.Car.Display()) & @Crlf)

    $JsObj.Car.Name = "Ford"
    $JsObj.Car.Color = "Black"
    ConsoleWrite('Car -> ' & ($JsObj.Car.Display()) & @Crlf)
    #ce

    ;#cs
    $JsObj.execScript("var Number = [1,2,3,4,5,6];")
    ConsoleWrite('Number.length -> ' & $JsObj.Number.length & @Crlf)
    ConsoleWrite('Number.toString -> ' & $JsObj.Number.toString('') & @Crlf)
    ConsoleWrite('Number.reverse -> ' & $JsObj.Number.reverse('').toString('') & @Crlf)
    ;#ce

    $JsObj = 0
    $o_Obj = 0
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __JsonObjCreate
; ========================================================================================
Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>Json_ObjCreate

; #FUNCTION# =============================================================================
; Name...........: __HTMLObject
; ========================================================================================
Func __HTMLObject($ObjHTML)
    Local $o_window = $ObjHTML.parentWindow
    Return $o_window
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HtmlFileErrorHandler
; ========================================================================================
Func __HtmlFileErrorHandler($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

but fail to run moment.min.js using htmlfile object

so is it possible to run Node.js => Moment Module using htmlfile object
or needed to convert this node.js package to javascript (is there any tool for such conversion o:))
to run using htmlfile object.

 

Edited by jugador
Link to comment
Share on other sites

It would be fine if you provide a code we can run.

 

 

Saludos

Link to comment
Share on other sites

@JockoDundee and @Danyfirex

I succeed in parsing Json using htmlfile object and it's pretty fast compare to JSON UDF(JSMN).

so thought can run other javascript code using htmlfile object.
and I am able to run OP code successfully (=> updated 1st post.... )

Now want to run moment.min.js for manipulating date/time using htmlfile object but it failed.

I downloaded moment.min.js and try to run it this way but it not working.

Func __HtmlFile()
    Local $moment_p = @ScriptDir & '\moment.min.js'
    Local $sHTML = '<!DOCTYPE HTML>' & @CRLF & _
            '<html>' & @CRLF & _
            '   <head>' & @CRLF & _
            '    <meta http-equiv="x-ua-compatible" content="IE=9"/>' & @CRLF & _
            '    <script src="' & $moment_p & '"></script>' & @CRLF & _
            '   </head>' & @CRLF & _
            '   <body>' & @CRLF & _
            '    <script>' & @CRLF & _
            '    </script>' & @CRLF & _
            '   </body>' & @CRLF & _
            '</html>' & @CRLF
    Return $sHTML
EndFunc

So it is possible to run moment.min.js using htmlfile object?

Link to comment
Share on other sites

Are you doing something like this?

 

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <string.au3>
#include <array.au3>


CreateHtmlPage()
Example()
Exit

Func Example()
    Local $hGUIMain = GUICreate("Event Test")
    Local $oIE = ObjCreate("Shell.Explorer.2")
    Local $hIE = GUICtrlCreateObj($oIE, 0, 0)
    $oIE.navigate('file:///' & @ScriptDir & '\Page.html')
    Sleep(1000) ; Give it some time to load the web page
    ToolTip("")
    Do ; wait for document
        Sleep(250)
        $oDocument = $oIE.document
    Until IsObj($oDocument)
    Local $ohJS = $oIE.document.parentwindow.JSglobal
    MsgBox(0, "", $ohJS.Eval("moment().format('MMMM Do YYYY, h:mm:ss a');"))

    $oIE = 0

EndFunc   ;==>Example

Func CreateHtmlPage()
    Local $sStart = @LF & "#cs;HTML"
    Local $sEnd = "#ce;HTML" & @CR
    Local $aArray = _StringBetween(FileRead(@ScriptFullPath), $sStart, $sEnd)
    Local $sPage = @ScriptDir & '\Page.html'
    Local $hFile = FileOpen($sPage, 2) ;  $FO_OVERWRITE (2) = Write mode (erase previous contents)
    FileWrite($hFile, $aArray[0])
    FileFlush($hFile)
    FileClose($hFile)
EndFunc   ;==>CreateHtmlPage

#cs;HTML
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <script type="text/javascript">
    var JSglobal = (1,eval)("this");
    </script>
    <script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>
    </head>
    <body>
    </body>
    </html>
#ce;HTML
;

 

or you're doing in a different way?

 

Saludos

 

Link to comment
Share on other sites

@Danyfirex  Your code work.
but when try to run the code using htmlfile object it failed.

Global $ObjErr = ObjEvent("AutoIt.Error", "__HtmlFileErrorHandler")

__Example_2()
Func __Example_2()
    Local $o_Obj = __HTMLFILEObjCreate()
    Local $JsObj = __HTMLObject($o_Obj)
    If Not IsObj($JsObj) Then Exit

    sleep(1000)
    Do ; wait for document
        Sleep(250)
        $oDocument = $JsObj.document
    Until IsObj($oDocument)

    Local $ohJS = $JsObj.document.parentwindow.JSglobal
    ConsoleWrite($ohJS.Eval("moment().format('MMMM Do YYYY, h:mm:ss a');") & @Crlf)
    ;line (18) : ==> COM Error intercepted !
    ;err.number is:         0x80020006
    ;err.windescription:    Unknown name.

    $JsObj = 0
    $o_Obj = 0
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __JsonObjCreate
; ========================================================================================
Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>Json_ObjCreate

; #FUNCTION# =============================================================================
; Name...........: __HTMLObject
; ========================================================================================
Func __HTMLObject($ObjHTML)
    Local $HTMLString = __HtmlFile()
    $ObjHTML.Write($HTMLString)
    $ObjHTML.close()
    Local $o_window = $ObjHTML.parentWindow
    Return $o_window
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HtmlFile
; ========================================================================================
Func __HtmlFile()
    Local $sHTML = '<!DOCTYPE HTML>' & @CRLF & _
            '<html>' & @CRLF & _
            '   <head>' & @CRLF & _
            '    <meta http-equiv="x-ua-compatible" content="IE=9"/>' & @CRLF & _
            '    <script type="text/javascript">' & @CRLF & _
            '    var JSglobal = (1,eval)("this");' & @CRLF & _
            '    </script>' & @CRLF & _
            '    <script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>' & @CRLF & _
            '   </head>' & @CRLF & _
            '   <body>' & @CRLF & _
            '   </body>' & @CRLF & _
            '</html>' & @CRLF
    Return $sHTML
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HtmlFileErrorHandler
; ========================================================================================
Func __HtmlFileErrorHandler($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

 

Link to comment
Share on other sites

Basic example -> Count Vowels :)
Array.prototype.includes() method not support IE :ranting:

#include <string.au3>
Global $ObjErr = ObjEvent("AutoIt.Error", "__HtmlFileErrorHandler")

__Example_2()
Func __Example_2()
    Local $o_Obj = __HTMLFILEObjCreate()
    Local $JsObj = __HTMLObject($o_Obj)
    If Not IsObj($JsObj) Then Exit

    Local $o_JsCode = __ReadCodeBlock()

    $JsObj.execScript($o_JsCode)
    ConsoleWrite('No of Vowels -> ' & $JsObj.CountVowels(6) & @Crlf)
    ConsoleWrite('No of Vowels -> ' & $JsObj.CountVowels('Hello WOrld') & @Crlf)

    $JsObj = 0
    $o_Obj = 0
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HTMLFILEObjCreate
; ========================================================================================
Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>

; #FUNCTION# =============================================================================
; Name...........: __HTMLObject
; ========================================================================================
Func __HTMLObject($ObjHTML)
    Local $HTMLString = __HtmlFile()
    $ObjHTML.Write($HTMLString)
    $ObjHTML.close()
    Local $o_window = $ObjHTML.parentWindow
    Return $o_window
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HtmlFile
; ========================================================================================
Func __HtmlFile()
    Local $sHTML = '<!DOCTYPE HTML>' & @CRLF & _
            '<html>' & @CRLF & _
            '   <head>' & @CRLF & _
            '    <meta http-equiv="x-ua-compatible" content="IE=9"/>' & @CRLF & _
            '    <script>' & @CRLF & _
            '    </script>' & @CRLF & _
            '   </head>' & @CRLF & _
            '   <body>' & @CRLF & _
            '   </body>' & @CRLF & _
            '</html>' & @CRLF
    Return $sHTML
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __ReadCodeBlock
; ========================================================================================
Func __ReadCodeBlock()
    Local $sStart = @LF & "#cs;CodeBlock"
    Local $sEnd = "#ce;CodeBlock" & @CR
    Local $aArray = _StringBetween(FileRead(@ScriptFullPath), $sStart, $sEnd)
    Return $aArray[0]
EndFunc   ;==>CreateHtmlPage

; #FUNCTION# =============================================================================
; Name...........: __HtmlFileErrorHandler
; ========================================================================================
Func __HtmlFileErrorHandler($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc


#cs;CodeBlock
function CountVowels(value){
  if (typeof value !== 'string') {
    return 'param should be a string'
  }
  vowels = ['a', 'e', 'i', 'o', 'u']
  countVowels = 0
  for (var i = 0; i < value.length; i++) {
    char = value[i].toLowerCase()
    if (includes(vowels, char)) {
      countVowels++
    }
  }
  return countVowels
}

function includes(Ary, chr) {
    for (var i = 0; i < Ary.length; i++) {
        if (Ary[i] === chr) {
            return true;
        }
    }
    return false;
}
#ce;CodeBlock
;

 

Edited by jugador
Link to comment
Share on other sites

nice this "htmlfile" object, do you have any reference for some documentation?

..... moment.js library works ...

__Example_2()
Func __Example_2()
    Local $o_Obj = __HTMLFILEObjCreate()
    $o_Obj.Open("text/html")
    $o_Obj.write(__HtmlFile2())
    $o_Obj.Close
    MsgBox(0, 0, 'give some time to load library')
    MsgBox(0, 0, $o_Obj.parentwindow.moment().format('MMMM Do YYYY, h:mm:ss a'))
EndFunc   ;==>__Example_2

Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>__HTMLFILEObjCreate


; #FUNCTION# =============================================================================
; Name...........: __HtmlFile
; ========================================================================================
Func __HtmlFile2()
    Local $moment_p = @ScriptDir & '\moment.min.js'
    Local $sHTML = '<!DOCTYPE HTML>' & @CRLF & _
            '<html>' & @CRLF & _
            '   <head>' & @CRLF & _
            '    <meta http-equiv="x-ua-compatible" content="IE=9"/>' & @CRLF & _
            '    <script src="https://momentjs.com/downloads/moment-with-locales.min.js"></script>' & @CRLF & _
            '   </head>' & @CRLF & _
            '   <body>' & @CRLF & _
            '    <script>' & @CRLF & _
            '    </script>' & @CRLF & _
            '   </body>' & @CRLF & _
            '</html>' & @CRLF
    Return $sHTML
EndFunc   ;==>__HtmlFile2

p.s.

to count vowels pass as string instead of a number...

$JsObj.CountVowels('6')

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

@Chimp You're code does not work for me. 

 

So I did a mod.

_Example()

Func _Example()
    _SetBroswerEmulation()
    Local $o_Obj = __HTMLFILEObjCreate()
    $o_Obj.write('<script src="https://momentjs.com/downloads/moment.min.js"></script>')
    $o_Obj.write('<script>var JSglobal = (1,eval)("this");</script>')
    $o_Obj.write('<script>function Hello(arg){return "Hello " + arg;}</script>')

    Local $oJs=$o_Obj.parentwindow.JSglobal
    MsgBox(0, "",$oJs.eval("moment().format('MMMM Do YYYY, h:mm:ss a');"))
    MsgBox(0, "",$oJs.Hello("Danyfirex"))

EndFunc   ;==>__Example_2

Func _SetBroswerEmulation()
    Local $sName=@AutoItExe
    Local $aSplit=StringSplit($sName,"\",1)
    $sName=$aSplit[$aSplit[0]]
    RegWrite("HKCU\Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION",$sName,"REG_DWORD",0x2AF9)
EndFunc

Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>__HTMLFILEObjCreate

 

Saludos

Edited by Danyfirex
Added Function Hello
Link to comment
Share on other sites

Hi @Danyfirex, you are right, thanks for your debugging. On my pc it worked because that registry key was already set, and so I didn't realize that without that key it doesn't work. while instead using the "browser control" ObjCreate ("Shell.Explorer.2"), it is not necessary to set that registry key, but it is sufficient to set the following directive in the <head> section of the html source:

<meta http-equiv="X-UA Compatible" content="IE=11" />

I think that since the "htmlfile" object doesn't render web pages, it doesn't take into account the content = "IE = 11" directive but instead the key value is needed 

edit:

so setting that registry key also at the beginning of my script, it works regularly, without the need to create the variable var JSglobal = (1, eval) ("this"); in the html source and without having to use the javascript eval method.

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

@Chimp I just added JSglobal  as example, you can call moment directly like in your example for that I added Hello function to denote you can call function without eval.

 

Saludos

Link to comment
Share on other sites

I'm not sure. does not work for you? what version are you using?

check this:

ConsoleWrite(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer","svcVersion") & @CRLF)

 

Saludos

Link to comment
Share on other sites

it seems that with IE versions lower than 11 that library does not work,
or at least, I have IE11 installed on my system, and I tried to change the value to be assigned to that registry key, as indicated at this link:

https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/general-info/ee330730(v=vs.85)?redirectedfrom=MSDN#browser_emulation


I noticed that if I use values lower than 0x2AF8, which activate the emulation of versions lower than IE11, that library seems not to work ...

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

IsJson :)
=> to check is json valid

#include <string.au3>
Global $ObjErr = ObjEvent("AutoIt.Error", "__HtmlFileErrorHandler")

__Example_2()
Func __Example_2()
    Local $o_Obj = __HTMLFILEObjCreate()
    Local $JsObj = __HTMLObject($o_Obj)
    If Not IsObj($JsObj) Then Exit

    Local $o_JsCode = __ReadCodeBlock("#cs;CodeBlock", "#ce;CodeBlock")
    $JsObj.execScript($o_JsCode)
    ConsoleWrite('IsJSON -> ' & $JsObj.IsJSON('{"name":"John","cars":{"A": "Ford","B": "BMW","C": "Fiat","D": "Chevy"}}') & @Crlf)
    ConsoleWrite('IsJSON -> ' & $JsObj.IsJSON('{"status":"ok", "data":{ "Value":[["2019-04-04",712,146],["2019-04-05",713,147]]}}') & @Crlf)

    $JsObj = 0
    $o_Obj = 0
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HTMLFILEObjCreate
; ========================================================================================
Func __HTMLFILEObjCreate()
    Local $Object = 0
    If IsObj($Object) Then $Object = 0
    $Object = ObjCreate("htmlfile")
    Return $Object
EndFunc   ;==>

; #FUNCTION# =============================================================================
; Name...........: __HTMLObject
; ========================================================================================
Func __HTMLObject($ObjHTML)
    Local $HTMLString = __HtmlFile()
    $ObjHTML.Write($HTMLString)
    $ObjHTML.close()
    Local $o_window = $ObjHTML.parentWindow
    Return $o_window
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __HtmlFile
; ========================================================================================
Func __HtmlFile()
    Local $sHTML = '<!DOCTYPE HTML>' & @CRLF & _
            '<html>' & @CRLF & _
            '   <head>' & @CRLF & _
            '    <meta http-equiv="x-ua-compatible" content="IE=9"/>' & @CRLF & _
            '    <script>' & @CRLF & _
            '    </script>' & @CRLF & _
            '   </head>' & @CRLF & _
            '   <body>' & @CRLF & _
            '   </body>' & @CRLF & _
            '</html>' & @CRLF
    Return $sHTML
EndFunc

; #FUNCTION# =============================================================================
; Name...........: __ReadCodeBlock
; ========================================================================================
Func __ReadCodeBlock($o_Start, $o_End)
    Local $sStart = @LF & $o_Start
    Local $sEnd = $o_End & @CR
    Local $aArray = _StringBetween(FileRead(@ScriptFullPath), $sStart, $sEnd)
    Return $aArray[0]
EndFunc   ;==>CreateHtmlPage

; #FUNCTION# =============================================================================
; Name...........: __HtmlFileErrorHandler
; ========================================================================================
Func __HtmlFileErrorHandler($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

#cs;CodeBlock
function IsJSON(str){
  try {
    JSON.parse(str);
    return true;
  }
  catch(e) {
    return false;
  }
};
#ce;CodeBlock
;

 

@Danyfirex as @Chimp mention to run this library IE11 needed.... so no possibility to run it on IE9.

Isn't there any hack to use other browser like chrome instead of IE with htmlfile object.

Edited by jugador
Link to comment
Share on other sites

3 hours ago, jugador said:

@Danyfirex as @Chimp mention to run this library IE11 needed.... so no possibility to run it on IE9.

Isn't there any hack to use other browser like chrome instead of IE with htmlfile object.

according to what stated here https://momentjs.com/docs/#/use-it/ it seems that the moment library should work from IE8 upwards.
In fact on tests I did some time ago (see here https://www.autoitscript.com/forum/topic/176731-autoit-javascript-roundtrip/?do=findComment&comment=1328480) that library worked.
In that case, however, I used the BrowserControl and not the "htmlfile" object, so maybe the problem could be some incompatibility with the "htmlfile" object.
Could you please try that script I wrote some time ago and see if it works for you?
p.s.
couldn't you also upgrade your IE to the latest IE11 version?

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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