gillesg Posted May 12, 2013 Posted May 12, 2013 Hi, 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 ? Regards. Gilles An example of what I want to achieve in config.jscmds[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++;with// For VC2008var VC2008_DIR = "..\\Restore Hope - Admin Tools\\Microsoft Visual C++\\VC++ 2008 SP1"var vc_2008 = "vc 2008SP1+ redist_" Quote
myselfidem Posted May 14, 2013 Posted May 14, 2013 (edited) Could you share your example working? It seems a new function is needed to create a variable with WPI. Edited May 14, 2013 by myselfidem Quote
gillesg Posted May 16, 2013 Author Posted May 16, 2013 (edited) Hi, Sorry for the delay. To make it runAdd in core.jsfunction 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 filevar APPS_DIR = "..\\MyApps" // Adobe Flash et shockwavevar FlashVersion="install_flash_player_ax (11.7.700.202)"var ShockwaveVersion="sw_lic_full_installer (12.0.2.122)"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 fileprog[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 Regards.PS : if needed I can post full config.js and WPI_Programl_config.js files. Edited May 17, 2013 by gillesg Quote
myselfidem Posted May 18, 2013 Posted May 18, 2013 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 Regards Quote
gillesg Posted May 20, 2013 Author Posted May 20, 2013 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 Regards 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 Regards. Gilles Quote
myselfidem Posted May 20, 2013 Posted May 20, 2013 Thanks, but I mean more code is needed and I'm not a coder and it's needed time to do ! Regards Quote
Kelsenellenelvian Posted May 20, 2013 Posted May 20, 2013 I see where your coming from and I see its possible usefulness but it would only really be usable in a business\corp setting and since wpi is not free for business uses and I have only sold 5 license in 7 years I really am not too keen on adding this feature. Quote
gillesg Posted May 21, 2013 Author Posted May 21, 2013 OK, I understand. For you to know, I added the feature for my personnal use, not for business use. Regards. Quote
bphlpt Posted May 21, 2013 Posted May 21, 2013 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=...etcinside 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 Quote
myselfidem Posted May 21, 2013 Posted May 21, 2013 @Kels Maybe you can distribute a corporate version and a public version: two separate versions? Regards Quote
bphlpt Posted May 21, 2013 Posted May 21, 2013 That would probably make more sense if he had more than 5 customers over 7 years. Cheers and Regards Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.