[wpkg-users] [WPKGWrapper...]

Marco Gaiarin gaio at sv.lnf.it
Thu Mar 22 11:05:03 CET 2007

Seems that messages hit antispam rules and not pass. i cut&paste the
script on bottom of message.

----- Forwarded message from Marco Gaiarin <gaio at sv.lnf.it> -----
From: Marco Gaiarin <gaio at sv.lnf.it>
Date: Thu, 22 Mar 2007 10:09:17 +0100
To: wpkg-users at lists.wpkg.org
Subject: WPKGWrapper...
Organization: La Nostra Famiglia - Polo FVG

Mandi! Tomasz Chmielewski
  In chel di` si favelave...

> > As a total .js ignorant: could keep this approach, eg, build a little
> > .js script that check an environment variable and then call wpkg.js?
> OK, let's practice some JScript - create a file called marco.js, with 
> contents:

My little exercise attached.

But seems that does not work, or at least expose some strangeness that
i'm not able to debug.

Particulary: if i run on a cmd.exe prompt:

	\\FILE\wpkg\wpkgwrapper.js /help

i'm expecting to have on the terminal the help. But nothing appear.

If i run (both external and internal) script with wscript instead of
cscript, help appear (as a window, of course).

I'm a total windows ignorant, but seems to me as my wrapper does not
connect STDIN/OUT/ERR correctly to the real cscript call.

Can you help me?

----- End forwarded message -----

// Configure here the Wrapper...
var env_var_name="LOCALNET";                            // Environment variable  name
var env_var_value="sv";                                 // Environment variable  value ('server value')
var wpkg_js="cscript \\\\FILE\\wpkg\\wpkg.js ";         // Remember to double the \ !!!

// Reapup commandline...
var cmdl = "";
var p = WScript.Arguments;
for (i=0; i < p.length; i++) {
        cmdl = (cmdl + p(i) + " " );

// Get environment var value...
var shell = new ActiveXObject("WScript.Shell");
var env_vars = shell.Environment("PROCESS");
var env_var_value_client = env_vars(env_var_name);

// Check against "server" one...
if (env_var_value_client == env_var_value) {
        var cmd = wpkg_js + " " + cmdl;
        WScript.Echo("Starting: " + cmd);
        var shellExec = shell.exec(cmd);
        WScript.Echo("Exit status: " + shellExec.status);

dott. Marco Gaiarin				    GNUPG Key ID: 240A3D66
  Associazione ``La Nostra Famiglia''                http://www.sv.lnf.it/
  Polo FVG  -  Via della Bontà, 7 - 33078  -  San Vito al Tagliamento (PN)
  marco.gaiarin(at)sv.lnf.it	  tel +39-0434-842711  fax +39-0434-842797

wpkg-users mailing list
wpkg-users at lists.wpkg.org

More information about the wpkg-users mailing list