General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion XMetal marco unable to run window.open(url)

  • akheiljain

    XMetal marco unable to run window.open(url)

    Participants 5
    Replies 6
    Last Activity 5 years ago

    XMetal macro JScript wont run
    window.open
    window.addEventListener

    does any one know why or how to make it work?

    Reply

    tonys

    Reply to: XMetal marco unable to run window.open(url)

    The window object is implemented by web browsers. Since XMetaL is not a browser, it doesn't exist.

    Reply

    akheiljain

    Reply to: XMetal marco unable to run window.open(url)

    Hi 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.

    Reply

    tonys

    Reply to: XMetal marco unable to run window.open(url)

    A good place to start would be the Windows Scripting Host documentation. It will tell you what is available to all applications that implement JScript.

    Reply

    tonys

    Reply to: XMetal marco unable to run window.open(url)

    This 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]

    Reply

    Derek Read

    Reply to: XMetal marco unable to run window.open(url)

    I'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,514

    Reply

    akheiljain

    Reply to: XMetal marco unable to run window.open(url)

    Hi 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);
        }//else

        function receiveMessage(event) {
            console.log(“Received message from: ” + event.origin);
    }

    The receiveMessage is never called.

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support