billjrm Posted December 24, 2005 Share Posted December 24, 2005 I Add a new Parameter called "Grayed condition" to determinate whether the application is installed.Item's checkbox will be disabled and the text color changed when "Grayed condition" meet.I also use AutoIt to write a simple program.CloseAudio.au3------------------if WinExists ("Media Player") then WinClose("Media Player")------------------And add a line on the bottom of function CreateFile to close "Media Player player" window when installation is finished.------------------------- window.moveTo(0,0); SetScriptWaitTimeout(-1); audioshell.run(".\\CloseAudio.exe", 1, true); <--- I added if (!debugOn) window.close(); -------------------------I don't really known about the Source of WPI, so this may not be a good solution.Wish these functions can add to the futher version.I comes from Taiwan. Sorry for my stupid English. Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 24, 2005 Share Posted December 24, 2005 Tell me more about this "greyed condition" how did you do and let me test it some please. Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 24, 2005 Share Posted December 24, 2005 (edited) Added in the close audio function.Your english is not too bad so do not worry about it. Edited December 24, 2005 by kelsenellenelvian Link to comment Share on other sites More sharing options...
billjrm Posted December 24, 2005 Author Share Posted December 24, 2005 (edited) The parameter "Greyed Condition" is similar to the parameter "Condition".Condition ---> hide itemGreyed Condition ---> disable item ( disable checkbox and change text color )Assume .Net Framework 1.1 is installed on my system. I can choice a file installed by .Net Framework 1.1%windir%\Microsoft.NET\Framework\sbs_diasymreader.dllSo Greyed Condition gcond[pn]=['FileExists("%windir%\\Microsoft.NET\\Framework\\sbs_diasymreader.dll")']I hard-coded text color in my program. It is better to define a new label class in wpi.css for this.Code I modifiedbox.js======function fillBoxes() { .......... .......... var winheight = screen.height; var i, cols, colwidth, a, b; var DoGray; //========================= added debug("Working on Windows " + getOSver(),1); if (sorting && CatsDefined()) SortPrograms(); .......... .......... if ((cons[i]!=null)) // constraint checking { a = cons[i][0]; b = cons[i][1]; if (replpath(a)!=replpath(b)) // constraint ... continue; } // ------------ added ------------------- // DoGray=0; if(!debugOn && gcond[i] && gcond[i][0]) { var d = unescape(replpath(gcond[i][0]).replace(/\\/g, "\\\\")); try { DoGray = eval(d) ? 1 : 0; } catch(e) { alert("Error in condition statement for " + prog[i] + ":\n\n" + gcond[i] + "\n\nTreating as a false condition."); continue; } } // ----------- added ------------------- // .......... .......... //insert checkbox and label // -- checkbox -- if (debugOn) txt += ('<font class="txt">' + i + '</font>\n'); txt += ('<input type="checkbox" id="chkbox' + i + '" '); if (uid[i]==null || uid[i]==""){ txt += ('name="chkbox' + i + '" '); if(DoGray) txt += ('disabled '); //=============================== Modified else txt += ('onclick="checkDeps(' + i + ');checkCategory(' + i + ')"'); //==== } else { txt += ('name="' + uid[i] + '" '); if(DoGray) txt += ('disabled '); //================================== else txt += ('onclick="checkDeps(' + i + ');checkCategory(' + i + ')"'); //====== } txt += ('/>\n'); // -- label -- txt += ('<label class="txt" '); if (uid[i]==null || uid[i]=="") txt += (' for="chkbox' + i + '" '); else { txt += ('for="' + uid[i] + '" '); if (!DoGray) txt += ('onClick="toggleChecked('+i+');checkDeps(' + i + ');checkCategory(' + i + ');" '); //======================================= } txt += ('onMouseOver="qdh(prog[' + i + '],desc[' + i + '],Style[0]);" '); txt += ('onMouseOut="htm();" '); txt += ('/>'); txt += ('<font color="'+ (DoGray ? 'sienna' : 'white')+'">'); //============= txt += (prog[i] + ((uid[i]&&debugOn)?(' ['+uid[i]+']'+'['+ordr[i]+']'):'')); //===== txt += ('</font>'); //======================================= txt += ('</label>\n<br>\n'); //================================= // -- .......... ..........}configwizard.js===============function SaveConfig(){ .......... .......... tf.WriteLine("// cond[pn]=['Javascript Conditional Statement to hide item']"); tf.WriteLine("//gcond[pn]=['Javascript Conditional Statement to gray item']"); //== added .......... .......... WriteConfigValue(tf, "cond", form.cond.value); WriteConfigValue(tf, "gcond", form.gcond.value); //======================= added .......... ..........}function ReadConfig(){ .......... .......... switch (opt) { ........... ........... case "cond": form.cond.value=val; break; case "gcond": //======================================= added form.gcond.value=val; //================================ break; //========================================== ........... ........... } .......... ..........}configwizardtemplate.htm=========================.......... .......... <tr> <td nowrap>Condition</td> <td colspan="8"> <input name="regb" type="text" class="CfgTextBox" id="cond" size="75"> </td> </tr> <!------------------------ added ----------------------------- <tr> <td nowrap>Grayed Condition</td> <td colspan="8"> <input name="gcond" type="text" class="CfgTextBox" id="gcond" size="75"> </td> </tr> -------------------------- added ----------------------------> .......... .......... Edited December 24, 2005 by billjrm Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 25, 2005 Share Posted December 25, 2005 Thanks I am woeking on adding these to WPI right now. Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 25, 2005 Share Posted December 25, 2005 (edited) Did yoo miss some thing? With the mods you posted I keep getting an error message that states gcond is undefined.Can you just post the three files you modified? Edited December 25, 2005 by kelsenellenelvian Link to comment Share on other sites More sharing options...
billjrm Posted December 25, 2005 Author Share Posted December 25, 2005 (edited) My WPI added some other feature which will be confused with this..... Sorry I missed this fileprogram.js==========......................var cond=[]; // Javascript conditional statement to check if this will be installed.var gcond=[]; //=======================================var cons=[]; // (deprecated) installation constraint......................function program(idx){ ...................... ...................... this.cond = cond[idx]; this.gcond= gcond[idx]; //================================= this.dflt = (dflt[idx]==null)?['no']:[dflt[idx][0]]; this.configs=(configs[idx]==null)?['']:[configs[idx][0]];}//write program objects back to array-variablesfunction WriteBackPrograms(programs){ ...................... ...................... cond[i+1]=programs[i].cond; gcond[i+1]=programs[i].gcond; //============================ configs[i+1]=programs[i].configs; } prog[programs.length+1]=null;}............................................ Edited December 25, 2005 by billjrm Link to comment Share on other sites More sharing options...
billjrm Posted December 25, 2005 Author Share Posted December 25, 2005 (edited) I modified WPI v4.3.6 according above and workI upload files I modified.I use "Bill mark" to the code I added or modified.4.3.6.rar Edited December 25, 2005 by billjrm Link to comment Share on other sites More sharing options...
billjrm Posted December 26, 2005 Author Share Posted December 26, 2005 (edited) Hello! I modify code further, I think this is betterI add a new gtxt style to wpi.ccs.gtxt{ font-family: arial; font-weight: bold; color : #A0522D; font-size : 8pt; margin-left: 5px; margin-right: 10px; margin-top: 10px; margin-bottom: 50px;}and change boxes.js (only list code about item label)v4.3.6function fillBoxes() { ............... ............... // -- label -- txt += ('<label class="txt" '); if (uid[i]==null || uid[i]=="") txt += (' for="chkbox' + i + '" '); else { txt += ('for="' + uid[i] + '" '); txt += ('onClick="toggleChecked('+i+');checkDeps(' + i + ');checkCategory(' + i + ');" '); } txt += ('onMouseOver="qdh(prog[' + i + '],desc[' + i + '],Style[0]);" '); txt += ('onMouseOut="htm();" '); txt += ('/>' + prog[i] + ((uid[i]&&debugOn)?(' ['+uid[i]+']'):'') + '</label>\n<br>\n'); // -- ................ ................}my codefunction fillBoxes() { ............... ............... // -- label -- if(DoGray) txt += ('<label class="gtxt" '); else txt += ('<label class="txt" '); if (uid[i]==null || uid[i]=="") txt += (' for="chkbox' + i + '" '); else { txt += ('for="' + uid[i] + '" '); if(!DoGray) txt += ('onClick="toggleChecked('+i+');checkDeps(' + i + ');checkCategory(' + i + ');" '); } txt += ('onMouseOver="qdh(prog[' + i + '],desc[' + i + '],Style[0]);" '); txt += ('onMouseOut="htm();" '); txt += ('/>' + prog[i] + ((uid[i]&&debugOn)?(' ['+uid[i]+']'):'') + '</label>\n<br>\n'); // -- ................ ................}Again, the codes I upload are modified from v4.3.64.3.6.new.rar Edited December 26, 2005 by billjrm Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 26, 2005 Share Posted December 26, 2005 Thank you very much. Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 27, 2005 Share Posted December 27, 2005 Now I am getting an "error in condition statement for dispay blank" Link to comment Share on other sites More sharing options...
billjrm Posted December 27, 2005 Author Share Posted December 27, 2005 (edited) Codes I modified about variable gcond[] refer to the variable cond[].Please test cond[] of unmodified version if gcond[] occurred error.Same situation should occur to variable cond[] of unmodified version if gcond[] occurred error.(I thought and not sure)I do not really know what you mean.Can you give me some example of config.js about this error.It's OK if gcond[pn]=[''] or gcond[pn] not present in my test. Edited December 27, 2005 by billjrm Link to comment Share on other sites More sharing options...
Kelsenellenelvian Posted December 27, 2005 Share Posted December 27, 2005 Sure here you go...pn=1;prog[pn]=['Display blank']uid[pn]=['Displayblank']picw[pn]=['128']pich[pn]=['128']desc[pn]=['Delete this file whe you are ready to start configuring WPI entries. Several Config files are in the "examples" Folder for you to look at and use as is needed for entries or examples.']textl[pn]=['Bottom']texti[pn]=['0']cmd1[pn]=['%cdrom%\\WPI\\Install\\']dflt[pn]=['yes']gcond[pn]=['%Windir%\\0.log']configs[pn]=['yes']cat[pn]=['Example']pn++ Link to comment Share on other sites More sharing options...
glent Posted December 27, 2005 Share Posted December 27, 2005 (edited) This is exaclty what I needed! thanx manworks fine here Edited December 27, 2005 by glent Link to comment Share on other sites More sharing options...
billjrm Posted December 27, 2005 Author Share Posted December 27, 2005 (edited) @kelsenellenelvianyou must use FileExists function.isgcond[pn]=["FileExists('%Windir%\\0.log')"]not gcond[pn]=['%Windir%\\0.log']@glentI am glad that you like this Edited December 27, 2005 by billjrm 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