ripley_jack Posted December 2, 2005 Share Posted December 2, 2005 How to use de condition line in the config.js file ?for example: to test if a prg is already installed ?tnxJack Link to comment Share on other sites More sharing options...
Dynaletik Posted December 2, 2005 Share Posted December 2, 2005 Hmm, I don't know, how to solve the problem with checking if an app is installed. I use my conditional statements, to test, if a file exists. This is useful to check if a driver is installed so the entry for the control panel for the device is only listed in WPI, when drevice is installed. I use it like this:cond[pn]=['FileExists("%systemdrive%\\Windows\\System32\\atiddc.dll")']This checks, if an ATI card is installed. Link to comment Share on other sites More sharing options...
oneless Posted December 3, 2005 Share Posted December 3, 2005 mineMP10FileExists("%ProgramFiles%\\Windows Media Player\\Skins\\9SeriesDefault.wmz")NAV2003FileExists("%ProgramFiles%\\Norton AntiVirus\\NAVW32.exe")Ad-Aware 6FileExists("%ProgramFiles%\\Lavasoft\\Ad-Aware SE Personal\\Ad-Aware.exe")bsplayerFileExists("%ProgramFiles%\\BSPlayer\\bsplayer.exe")7zipFileExists("%ProgramFiles%\\7-Zip\\7zFM.exe")Adobe Reader 6FileExists("%ProgramFiles%\\Adobe\\Acrobat 6.0\\Reader\\AcroRd32.exe")DirectX 9FileExists("%SystemDrive%\\Windows\\system32\\d3d9.dll")K lite mega codeck pakFileExists("%ProgramFiles%\\K-Lite Codec Pack\\unins000.exe")and so onbut you cant be sure 100% because , for example , i look for Adobe Reader 6 , and maybe is installed 5 or 7 ...help me 100% on a clean install . Link to comment Share on other sites More sharing options...
lawrenca Posted December 31, 2005 Share Posted December 31, 2005 (edited) This is a sample from my config.js file:;This FileExists condition checks to make sure I have the file available on my CD/DVD and the !WshShell.regRead checks to make sure the registry entry is not present...not installed on my machine...WshShell.regRead would check to see if the registry entry was presentcond[pn]=['FileExists("%CDROM%\\Install\\AWEs\\AC130H_2.05.31\\setup.exe") && !WshShell.regRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AC-130H\\DisplayName")=="AC-130H PFPS AWE"'];This is a duplicate entry in my config.js file that will actually change the font color of the WPI checkbox entry and launch a different command if the registry entry is found...it is only dependent on the registry entry and not on file existence.cond[pn]=['WshShell.regRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AC-130H\\DisplayName")=="AC-130H PFPS AWE"'];This is the line that will change the fontprog[pn]=['<font color=FF9900">AC-130H AWE 2.05.31 Uninstall</font>];as opposed to my original application installation entryprog[pn]=['AC-130H AWE 2.05.31'];Below is the 2 complete entries I've included in my config.js fileprog[pn]=['<font color="FF9900">AC-130H AWE 2.05.31 Uninstall</font>']uid[pn]=['AC130HUninstall']picw[pn]=['128']pich[pn]=['128']desc[pn]=['•Uninstall AC-130H PFPS AWE']textl[pn]=['Bottom']texti[pn]=['1']ordr[pn]=[700]cmd1[pn]=['"C:\\WINDOWS\\IsUninst.exe -fC:\\PFPS\\Ac130h\\AC-130H_UNINSTAL.isu" -a -y -s']cond[pn]=['WshShell.regRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AC-130H\\DisplayName")=="AC-130H PFPS AWE"']configs[pn]=['No']cat[pn]=['Uninstall']pn++prog[pn]=['AC-130H AWE 2.05.31']uid[pn]=['AC130HAWE20531']picw[pn]=['128']pich[pn]=['128']desc[pn]=['•Prepare AC-130H mission data']textl[pn]=['Bottom']texti[pn]=['1']ordr[pn]=[700]cmd1[pn]=['"%CDROM%\\Install\\AWEs\\AC130H_2.05.31\\setup.exe" /SMS /s']dflt[pn]=['yes']cond[pn]=['FileExists("%CDROM%\\Install\\AWEs\\AC130H_2.05.31\\setup.exe") && !WshShell.regRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\AC-130H\\DisplayName")=="AC-130H PFPS AWE"']configs[pn]=['yes']cat[pn]=['AWEs']pn++;One last important change that must be made to your boxes.js file, unless you want to see several dialogs "treating statement as a false condition". You must comment out or delete the condition presenting you this dialog box (3rd line from the bottom of the render block of code (//alert("Error in condition statement for " + prog + ":\n\n" + cond + "\n\nTreating as a false condition.") // // Render // debug("Rendering of boxes started",1); tabs++; txt += ('<a name="#pg1"></a>'); txt += ('<table class="tclass" cellspacing=0 cellpadding=0><tr class="rtclass"><td width="' + colwidth + '%" valign="top" nowrap>'); for (i=1; (prog[i]!=null); i++) // for defined programs do ... { // We only display things that pass condition tests, unless we are in debug mode. // if(cond[i] && cond[i][0]) { var c = unescape(replpath(cond[i][0]).replace(/\\/g, "\\\\")); try { if(!eval©) { debug("Condition failed: " + c + " -- not rendering " + prog[i], 1); continue; } } catch(e) { //alert("Error in condition statement for " + prog[i] + ":\n\n" + cond[i] + "\n\nTreating as a false condition."); continue; Edited February 13, 2006 by lawrenca Link to comment Share on other sites More sharing options...
Swimming_Bird Posted January 5, 2006 Share Posted January 5, 2006 please use the code tags for ur post lawrenca Link to comment Share on other sites More sharing options...
Dynaletik Posted February 13, 2006 Share Posted February 13, 2006 Hey guys. Is it possible, to make multiple conditions, so that an entry is shown when the one OR the other file exists? I would like to show the SB Live/Audigy entry in my WPI when the conditiongcond[pn]=['FileExists("%systemdrive%\\Windows\\System32\\SBAudigy.ico")'] or the conditiongcond[pn]=['FileExists("%systemdrive%\\Windows\\System32\\SBLive.ico")'] is fulfilled. Can I combine them? Link to comment Share on other sites More sharing options...
lawrenca Posted February 13, 2006 Share Posted February 13, 2006 For Javascript, Or is written as || and is used when more than a one condition should result in the check being true. (|| is achieved by using the shift key combined with the \ key).You can combine multiple statements as long as they resolve as a boolean expression for Javascript.Example of Or:cond[pn]=['FileExists("%CDROM%\\WPI.ico") || FileExists("%CDROM%\\WPI.cmd")']Example of And:cond[pn]=['FileExists("%CDROM%\\WPI.ico") && FileExists("%CDROM%\\WPI.cmd")']Same goes for the gcond! Link to comment Share on other sites More sharing options...
Dynaletik Posted February 13, 2006 Share Posted February 13, 2006 Thanks. This works now. Link to comment Share on other sites More sharing options...
lawrenca Posted March 2, 2006 Share Posted March 2, 2006 (edited) apokok,The code for registry checking I mentioned above has changed since the latest releases of WPI, doesn't function quite right. I've included a sample of an older version for you but it was well before gcond existed...not sure all the code that's changed but I always had to suppress that message you are talking about (found in boxes.js line 69 in my file...I just comment it out). //alert("Error in condition statement for " + prog[i] + ":\n\n" + cond[i] + "\n\nTreating as a false condition.");I always deployed two of the same apps in my config.js...one that showed different color and would launch uninstall of an application and one for the silent install. I definately think it's easier to do the file checking for application existence...maybe some room for improvement on the newer versions? I've include the 7zip.reg file that will import the file for checking in the root of this zip and also the remove7zip key file.Download Here Edited March 2, 2006 by lawrenca Link to comment Share on other sites More sharing options...
lawrenca Posted March 11, 2006 Share Posted March 11, 2006 apokok,Another way to attack this...write your Uninstall Keys>DisplayNames (or whatever you decide) to files then use the file checking on these newly written files. Wrote a rough cut using AutoIT (actually going to incorporate it in my wpi.exe because I use it to start WPI (compiled AutoIT that replaces the WPI.cmd). Compiled executable could be called from WPI.cmd if you like.cond and gcond would look like this:C:\WINDOWS\system32\UninstallKeys\"whatever your file would be called"Example:FileExists("%sysdir%\UninstallKeys\7-Zip 4.32")These files can be viewed in notepad or any other editor...you can compile them to .exe with AutoIT (free download).Incorporated into the latest version I am currently using (spin-off of 4.3.8 and 4.4rc1). Definately back up your data as this version will overwrite code, especially in config.js.Download My Version Here!Attached are my wpi.au3 and also a stand-alone .au3 that iterates through the registry and writes the DisplayName of "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"...Programs to the system32\UninstallKeys folder.WriteReg2File.au3wpi.au3 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now