Jump to content

My WPI and some suggestions...


Recommended Posts

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.

post-13955-1135401724_thumb.jpg

Link to comment
Share on other sites


The parameter "Greyed Condition" is similar to the parameter "Condition".

Condition ---> hide item

Greyed 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.dll

So 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 modified

box.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 by billjrm
Link to comment
Share on other sites

My WPI added some other feature which will be confused with this.....

Sorry I missed this file

program.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-variables
function 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 by billjrm
Link to comment
Share on other sites

Hello! I modify code further, I think this is better

I 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.6

function 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 code

function 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.6

4.3.6.new.rar

Edited by billjrm
Link to comment
Share on other sites

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 by billjrm
Link to comment
Share on other sites

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

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...