mingongzhang 发表于 2014-9-12 16:37:54

ScriptControl怎样获取javascript返回的数组?

代码如下:#include <Array.au3>
#include <File.au3>

$jsCode = FileRead(@ScriptDir & "\js.js")
        If @error Then MsgBox(0,"", "没读到js文件")
$nJS = ObjCreate("ScriptControl")
$nJS.language = "JavaScript"
$nJS.addcode($jsCode)
$nResult = $nJS.eval('gets()')
        If @error Then MsgBox(0,"eval",@error)
If IsArray($nResult) Then
        _ArrayDisplay($nResult)
Else
        ConsoleWrite($nResult)
EndIfjs代码:function gets()
{
    return Array(1,2,3,4,5,6,7,8,9);
}
页: [1]
查看完整版本: ScriptControl怎样获取javascript返回的数组?