0
点赞
收藏
分享

微信扫一扫

[AHK]用AHK执行JavaScript

i奇异 2023-04-24 阅读 57


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



举报

相关推荐

0 条评论