本帖最后由 manbutianya 于 2014-6-7 14:59 编辑 Local $sCode = ""
$sResult = _ramshu() ;产生随机小数
MsgBox(0,"产生随机小数",$sResult)
Func _ramshu() ;产生随机小数
$sCode &= 'function json3str()' & @CRLF
$sCode &= '{' & @CRLF
$sCode &= "today = new Date();" & @CRLF
$sCode &= "num = Math.abs(Math.sin(today.getTime()));" & @CRLF
$sCode &= 'return num;' & @CRLF
$sCode &= '}' & @CRLF
;MsgBox(0, "代码", $sCode)
Local $oScript = ObjCreate("MSScriptControl.ScriptControl.1")
$oScript.language = 'JavaScript'
$oScript.AddCode($sCode)
$sResult = $oScript.Run('json3str')
$oScript = 0
;MsgBox(0, "P值", $sResult)
Return $sResult
EndFunc
出现以下错误:
"G:\softs\au3\??????????.au3" (13) : ==> Variable must be of type "Object".:
$oScript.language = 'JavaScript'
$oScript^ ERROR |