sc := ComObjCreate("ScriptControl")
;// define the Language
sc.Language := "JScript"
;// define the JScript
script =
(
string = '';
obj = { 'Name':'AutoHotkey', 'URL':'www.AutoHotkey.com', 'Color':'Green' };
for (i in obj)
string += i + ' = ' + obj[i] + '\n';
)
;// execute the JScript
sc.ExecuteStatement(script)
;// extract a value from the JScript
MsgBox, 0, JScript Variable "string":, % sc.Eval("string")
;// extract an Object from the JScript
obj := sc.Eval("obj")
MsgBox, 0, Elements from the JScript Object:, % "Name: " obj.Name "`nURL: " obj.URL
[AHK]用AHK执行JavaScript
最新推荐文章于 2024-09-04 07:06:51 发布