Page 1 of 1

how to call XYplorer script from web-page?

Posted: 21 May 2014 18:19
by ruslaw
In the topic "Command line" there was an advice how to make XYplorer to open left and right panel with definite directories.
It was supporting files StartXYplorer.exe and StartXYplorer.ini and command line code:
<your path to StartXYplorer.exe>\StartXYplorer.exe "<path for left side>" "<path for right side>"
OK! I can make bat file and it gives me an effect.
But what if I need to call this code from html page? Can I do it? Can I use javascript and how?

Re: how to call XYplorer script from web-page?

Posted: 21 May 2014 18:58
by highend
http://stackoverflow.com/questions/2800 ... -hyperlink

E.g.:

Code: Select all

<html>
    <head>
        <script type="text/javascript">
        function runProgram()
        {
            var shell = new ActiveXObject("WScript.Shell");
            var appWinMerge = "\"D:\\Users\\Highend\\Tools\\Xyplorer\\XYplorer.exe\" /script=\"::msg 'Welcome'\"";
            shell.Run(appWinMerge);
        }
        </script>
    </head>

    <body>
        <a href="javascript:runProgram()">Run program</a>
    </body>
</html>
Adapt your path and the script content...

Re: how to call XYplorer script from web-page?

Posted: 22 May 2014 19:43
by ruslaw
Thans a lot!
I have adopted for my purpose (to open definite directory) so:

Code: Select all

 <script type="text/javascript">
        function runProgram()
        {
            var shell = new ActiveXObject("WScript.Shell");
            var appWinMerge = "\"D:\\programs\\xyplorer\\XYplorer.exe\" /script=\"::goto 'E:/Documents'\"";
            shell.Run(appWinMerge);
        }
<a href="javascript:runProgram()">Run program</a>
And it works well.
But can I somehow transform it into function with argument like so:

Code: Select all

 <script type="text/javascript">
        function runProgram(path)
        {
            var shell = new ActiveXObject("WScript.Shell");
            var appWinMerge = "\"D:\\programs\\xyplorer\\XYplorer.exe\" /script=\"::goto path\"";
            shell.Run(appWinMerge);
        }
        </script>
  <a href="javascript:runProgram('E:/Documents')">Run program</a>
Given above example doesn't work but I need I could use one piece of code for function and to vary destination folders within <body></body>
Is it possible?

Re: how to call XYplorer script from web-page?

Posted: 23 May 2014 00:13
by highend

Code: Select all

<html>
    <head>
        <script type="text/javascript">
        function runProgram(path)
        {
            var shell = new ActiveXObject("WScript.Shell");
            var appWinMerge = "\"D:\\programs\\xyplorer\\XYplorer.exe\" /script=\"::goto \"" + path + "\"\"";
            shell.Run(appWinMerge);
        }
        </script>
    </head>

    <body>
        <a href="javascript:runProgram('E:/Documents')">Run program</a>
    </body>
</html>
It's nothing more than concatenating the local path variable...