Advertisement
omegastripes

Get JS Global Object within VBScript.vbs

Mar 23rd, 2014
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' получение jsglobal
  2. set htmlfile = createobject("htmlfile")
  3. set jsglobal = htmlfile.parentwindow
  4. jsglobal.execscript ";", "jscript"
  5. ' тестирование
  6. msgbox jsglobal.math.pi ' отображает 3,14159265358979
  7. jsglobal.eval("var dict = new ActiveXObject('Scripting.Dictionary'); dict('mykey') = 'myvalue'; alert('test');")
  8. msgbox jsglobal.dict.item("mykey") ' отображает myvalue
  9. msgbox typename(jsglobal.eval("window")) ' отображает Empty
  10. msgbox typename(jsglobal.eval("this")) ' отображает Empty
  11. msgbox typename(jsglobal.eval("(function (){return window})()")) ' отображает Empty
  12. msgbox typename(jsglobal.eval("(function (){return this})()")) ' отображает Empty
  13. msgbox jsglobal.eval("({transfer:window})").transfer is jsglobal ' отображает Истина
  14. msgbox jsglobal.eval("({transfer:this})").transfer is jsglobal ' отображает Истина
  15. set htmlfile = nothing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement