Jump to content

Recommended Posts

For my personnal usage I found a way to use variable in config.js.
Before publishing anyting, I was wondering if there is a standard way to do so  ?
An example of what I want to achieve in config.js

cmds[pn]=['{START} "VC2008" /B /WAIT "%wpipath%\\' + VC2008_DIR + '\\' + vc_2008 + 'x86.exe" /q',	'{x64} {START} "VC2008x64" /B /WAIT "%wpipath%\\' + VC2008_DIR + '\\' + vc_2008 + 'x64.exe" /q'];cond[pn]=['getOSver()=="Win7" && FileExists("%wpipath%\\" + VC2008_DIR + "\\" + vc_2008 + "x86.exe")'];pn++;


// For VC2008var VC2008_DIR = "..\\Restore Hope - Admin Tools\\Microsoft Visual C++\\VC++ 2008 SP1"var vc_2008 = "vc 2008SP1+ redist_"
Link to post
Share on other sites



Sorry for the delay.


To make it run

Add in core.js

function include(fileName){document.write("<script src='../UserFiles/"+fileName+"'></script>" );}include('WPI_program_config.js');// WPI_program_config.js can be any name you want to add in UserFiles Folder[/font]

In UserFiles folder create a file named "WPI_program_config.js"

Syntax of WPI_program_config.js file

var APPS_DIR = "..\\MyApps" // Adobe Flash et shockwavevar FlashVersion="install_flash_player_ax (11.7.700.202)"var ShockwaveVersion="sw_lic_full_installer ("var FLASH_DIR="..\\Restore Hope - Admin Tools\\Adobe Flash & Shockwave" // Javavar Javax64_version="jre-7u21-windows-x64"var Java_version="jre-7u21-windows-i586"var Java_dir="..\\Restore Hope - Admin Tools\\Java"


use in config.js file

prog[pn]=['Installer les KB Windows 7 x64 sans reboot'];uid[pn]=['KB'];desc[pn]=['Installer les KB Windows 7 x64 sans reboot'];dflt[pn]=['yes'];forc[pn]=['no'];bit64[pn]=['no'];cat[pn]=['Admin Tools'];configs[pn]=['Win7,7 Add'];cmds[pn]=['{x64} {START} "KB2533552" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\KB2533552\\Windows6.1-KB2533552-x64.msu" /quiet /norestart','{x64} {START} "KB2603229" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\KB2603229\\Windows6.1-KB2603229-x64.msu" /quiet /norestart','{x64} {START} "msXML 4 SP3" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\msXML 4 SP3\\msxml4 SP3.msi" /quiet /norestart','{x64} {START} "msXML4 KB2758694" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\msXML 4 SP3\\msxml4-KB2758694-fra.exe" /quiet /norestart','{x64} {START} "DirectX" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\DirectX.End-User.Runtimes.(June 2010)\\DXSETUP.exe" /Silent','{x64} {START} "rvkroots" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\rvkroots\\rvkroots.exe"','{x64} {START} "rootsupd" /B /WAIT "%wpipath%\\' + APPS_DIR + '\\rootsupd\\AMD64-all-rootsupd.exe"'];cond[pn]=['getOSver()=="Win7" && FileExists("%wpipath%\\" + APPS_DIR + "\\KB2533552\\Windows6.1-KB2533552-x64.msu")'];pn++;  prog[pn]=['Flash Player'];uid[pn]=['FLASH'];desc[pn]=['Installer Flash player pour IE'];dflt[pn]=['yes'];forc[pn]=['no'];bit64[pn]=['no'];cat[pn]=['Admin Tools'];configs[pn]=['Win7,Lite,Post SP3'];cmds[pn]=['{START} "FLASH" /B /WAIT "%wpipath%\\' + FLASH_DIR + '\\' + FlashVersion + '.exe" -install'];cond[pn]=['FileExists("%wpipath%\\" + FLASH_DIR + "\\" + FlashVersion + ".exe")'];pn++; prog[pn]=['Shockwave player'];uid[pn]=['SHOCKWAVE'];desc[pn]=['Installer ShockWave player'];dflt[pn]=['yes'];forc[pn]=['no'];bit64[pn]=['no'];cat[pn]=['Admin Tools'];configs[pn]=['Win7,Lite,Post SP3'];cmds[pn]=['{START} "Shock" /B /WAIT "%wpipath%\\' + FLASH_DIR + '\\' + ShockwaveVersion + '.exe" /S'];cond[pn]=['FileExists("%wpipath%\\" + FLASH_DIR + "\\" + ShockwaveVersion + ".exe")'];pn++;

So when there is an update, just modify WPI_Program_config.js and not the config.js file



PS : if needed I can post full config.js and WPI_Programl_config.js files.

Edited by gillesg
Link to post
Share on other sites

Thank you for sharing.

But the method seems complicated for an automated method for the user!


However, the idea is interesting and deserves to be improved



This is just right, but when you start using variables, you are not anymore a simple user.

In fact, just adding the function in core.js opens the possibility to use variables defined in the WPI_program_file.js



Link to post
Share on other sites

Maybe I'm missing something since I'm by no means a javascript expert, but can't the same result be accomplished by adding the "variable definition section", ie:

var APPS_DIR=...
var FlashVersion=...
var ShockwaveVersion=...
var FLASH_DIR=...

inside config.js, instead of in a separate external "WPI_program_config.js"?  If so, it would mean not having to modify core.js, it would eliminate the "extra" file "WPI_program_config.js", and it would still have the same result, wouldn't it?  I would think that grouping all the definitions together would be just as convenient as having them in a separate file.  The only reason I can see a separate file having an advantage is if the main parts of WPI were burned onto a DVD and the "WPI_program_config.js" file and the addons were in a separate install medium, say a USB key,  But if you were going to use a USB key at all, then why not use it for all the WPI files since installation from USB is usually faster than from DVD anyway?
As to using the variables in the first place, in addition to their usefulness in a business/corp setting, I personally use variables even in my own coding for my own use as a shortcut or abbreviation and to help minimize the possibility of a coding typo, especially for things that will change, say when a program or addon is updated. As an example, "FlashVersion" is a whole lot shorter and easier to type than "install_flash_player_ax (11.7.700.202)" after all.  Just my opinion, and as I said, I could have totally misunderstood the situation.


Cheers and Regards

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...