Jump to content

Adding Additional Variables To Be Used With Wpi?


Recommended Posts


@durex I don't know about anybody else, but I'm a little confused by the question: not sure what is meant by "add additional variables." Can you provide an example of what you are trying to accomplish? Thanks.

Link to comment
Share on other sites

Sure can...

In my RunOnceEx script, to save on some typing, I would create additional variables to be used throughout the script..

ie:

APPS = %CDROM%\Custom\Applications
REG =  %CDROM%\Custom\Registry
SYSTEM = %CDROM%\Custom\System
RESTORE = D:\!Personal!\SystemBackup

This way when Im inputting execute / install lines throughout runonceex, I can simply use these variables instead of having to type out the entire path every time....

Now, after pawing through the js files, I think Ive figured it out... if someone could verify my work here, Id greatly appreciate it as vbscript is my scripting language of choice.. not JS...

In the 'generate.js' file I found the following section which looks like it converts system variables to ones to be used throughout WPI...

function replpath(u) {  
position = "generate.js";
cddrv = FindCDRom();
sysdrv = WshEnv("SYSTEMDRIVE") + "\\";
.....

As well as this section...

rs = rs.replace(/%cdrom%/gi, cddrv); 	 
rs = rs.replace(/%systemdrive%/gi,sysdrv);
rs = rs.replace(/%windir%/gi, windir);  
.......

So I made the following additions to allow the use of my variables..

apps = cddrv + "Custom\\Applications\\";
network = cddrv + "Custom\\Network\\";
reg = cddrv + "Custom\\Registry\\";
restore = "D:\\!Personal!\\SystemBackup\\";
system = cddrv + "Custom\\System\\";

and

rs = rs.replace(/%apps%/gi, appdata)	
rs = rs.replace(/%network%/gi, network)
rs = rs.replace(/%reg%/gi, reg)
rs = rs.replace(/%restore%/gi, restore)
rs = rs.replace(/%system%/gi, system)

Ive only tested it with an absolute path (C:\Temp), I havent tested the "cddrv +", lines, but it appears as though it should work...

Make sense?

Link to comment
Share on other sites

  • 1 month later...

I have created a System variable on the XP client like this:

Variable = apps

Value = \\dc01\apps

And in the generate.js i added this:

Under the function replpath(u) add:

apps = WshEnv("apps") + "\\";

rs = rs.replace(/%apps%/gi, apps);

Best regards

Erling Johansen

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...