General XMetaL Discussion
XMetaL Community Forum › General XMetaL Discussion › XMetal marco unable to run window.open(url)
-
akheiljain June 21, 2017 at 8:52 pm
XMetal marco unable to run window.open(url)
June 21, 2017 at 8:52 pmParticipants 5Replies 6Last Activity 5 years, 7 months agoXMetal macro JScript wont run
window.open
window.addEventListenerdoes any one know why or how to make it work?
tonys June 21, 2017 at 10:57 pm
Reply to: XMetal marco unable to run window.open(url)
June 21, 2017 at 10:57 pmThe window object is implemented by web browsers. Since XMetaL is not a browser, it doesn't exist.
akheiljain June 22, 2017 at 2:44 pm
Reply to: XMetal marco unable to run window.open(url)
June 22, 2017 at 2:44 pmHi Tonys,
Thank you for your reply, would there be another way to accomplish this in XMetal, I need to launch a URL window, attach an event listener to it and get event data back. I am able to run the JS directly through Chrome, but not sure how to accomplish it through an xmetal macro.tonys June 22, 2017 at 9:34 pm
Reply to: XMetal marco unable to run window.open(url)
June 22, 2017 at 9:34 pmA good place to start would be the Windows Scripting Host documentation. It will tell you what is available to all applications that implement JScript.
tonys June 22, 2017 at 9:49 pm
Reply to: XMetal marco unable to run window.open(url)
June 22, 2017 at 9:49 pmThis topic might also be relevant: [url=http://forums.xmetal.com/index.php/topic,3706.0.html]http://forums.xmetal.com/index.php/topic,3706.0.html[/url]
Derek Read June 22, 2017 at 11:23 pm
Reply to: XMetal marco unable to run window.open(url)
June 22, 2017 at 11:23 pmI'm not sure what the exact final goal is but perhaps one of these posts that include some example code will help?
http://forums.xmetal.com/index.php/topic,512
http://forums.xmetal.com/index.php/topic,514akheiljain July 6, 2017 at 3:59 pm
Reply to: XMetal marco unable to run window.open(url)
July 6, 2017 at 3:59 pmHi Derek,
I was able to run my js using the sample http://forums.xmetal.com/index.php/topic,514.0.html, but once the event takes place in the browser window, it doesn't report the event back to XMetal.
I have the mcr set to :
// XMetaL Script Language JSCRIPT:
ResourceManager.Visible = true;
ResourceManager.RemoveTab( “Assets” );
ResourceManager.RemoveTab( “Desktop” );
ResourceManager.RemoveAllTabs();
ResourceManager.AddTab(“Web Service”,”Shell.Explorer”);
ResourceManager.SelectTab(“Web Service”);
WebService = ResourceManager.ControlInTab( “Web Service” );
WebService.navigate( “file:///C:/Program%20Files%20(x86)/XMetaL%209.0/Author/Forms/resManTest.html” );
]]>And the html file looks like :
window.open(“http://hw-en-daem-ap01:8080″,”Picker”)
if(window.addEventListener) {
window.addEventListener(“message”, receiveMessage, false);
}//if
else if (window.attachEvent) {
window.attachEvent(“onmessage”, receiveMessage, false);
}//elsefunction receiveMessage(event) {
console.log(“Received message from: ” + event.origin);
}The receiveMessage is never called.
-
AuthorPosts
- You must be logged in to reply to this topic.