Jump to content

WPI 8.6 and beyond bug\bugfix thread


Recommended Posts


Hi myselfidem.

I do not know if you've noticed it.

But if you stop de timer self, and start WPI Installer by click.

The Clock is working fine.

If you let the timer do his work,and automatic start WPI Installer.

Then Clock is freezes in 2 sec.

Maybe this will help you to find the problem!!..

Grt Whatsup

Link to comment
Share on other sites

Thanks Watsup!

Yes, I also noticed that.

The trouble is when all programs to install are selected by default, or if we want install all programs already selected and without intervention !

It seems the problem occurs when installing the first program with Installer.hta when IE10 is integrated.

However, inside WPI_Log.txt the time values are correct!

I'm always looking a workaround.

Link to comment
Share on other sites

  • 3 weeks later...

I use this workaround to display the timer inside Installer.hta:

Inside timers.js

Replace function ins_iTimer() with:


function ins_iTimer()
{
position="timers.js";
whatfunc="ins_iTimer()";

var timerID=null;
var txt="";
var now=new Date();
var nowSecs=(now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds();
var elapsedSecs=nowSecs - ins_startSecs;

var hours=Math.floor(elapsedSecs/3600);
elapsedSecs=elapsedSecs - (hours*3600);

var minutes=Math.floor(elapsedSecs/60);
elapsedSecs=elapsedSecs - (minutes*60);

var seconds=elapsedSecs;

txt=((hours < 10) ? "0" : "") + hours;
txt += ((minutes < 10) ? ":0" : ":") + minutes;
txt += ((seconds < 10) ? ":0" : ":") + seconds;

document.getElementById("TimerDisplay").innerHTML=txt;
timerID=setTimeout("ins_iTimer()",1000); // Update display
}

Tested and works fine for me! Thanks to share your result!

*Edit: I spent days and days to find this workaround!

Edited by myselfidem
Link to comment
Share on other sites

For an admittedly extremely small code reduction, you can change:

 var minutes=Math.floor(elapsedSecs/60);
elapsedSecs=elapsedSecs - (minutes*60);

var seconds=elapsedSecs;

to:

 var minutes=Math.floor(elapsedSecs/60);
var seconds=elapsedSecs - (minutes*60);

You can also eliminate:

 var txt="";

and change:

 txt=((hours < 10) ? "0" : "") + hours;

to:

 var txt=((hours < 10) ? "0" : "") + hours;

You also should be able to eliminate:

 var timerID=null

and change:

 timerID=setTimeout("ins_iTimer()",1000);  // Update display

to:

 var timerID=setTimeout("ins_iTimer()",1000);  // Update display

And you can save a line and eliminate a variable by changing:

 var nowSecs=(now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds();
var elapsedSecs=nowSecs - ins_startSecs;

to:

 var elapsedSecs=((now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds()) - ins_startSecs;

If you don't mind long code lines, you could even eliminate another variable by changing:

 txt=((hours < 10) ? "0" : "") + hours;
txt += ((minutes < 10) ? ":0" : ":") + minutes;
txt += ((seconds < 10) ? ":0" : ":") + seconds;

document.getElementById("TimerDisplay").innerHTML=txt;

to:

 document.getElementById("TimerDisplay").innerHTML=((hours < 10) ? "0" : "") + hours + ((minutes < 10) ? ":0" : ":") + minutes + ((seconds < 10) ? ":0" : ":") + seconds;

So the new code would be:


function ins_iTimer()
{
position="timers.js";
whatfunc="ins_iTimer()";

var now=new Date();
var elapsedSecs=((now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds()) - ins_startSecs;

var hours=Math.floor(elapsedSecs/3600);
elapsedSecs=elapsedSecs - (hours*3600);

var minutes=Math.floor(elapsedSecs/60);
var seconds=elapsedSecs - (minutes*60);

document.getElementById("TimerDisplay").innerHTML=((hours < 10) ? "0" : "") + hours + ((minutes < 10) ? ":0" : ":") + minutes + ((seconds < 10) ? ":0" : ":") + seconds;
var timerID=setTimeout("ins_iTimer()",1000); // Update display
}

Only a total of 2 variables and 7 lines of code eliminated, plus 2 blank lines, and you'll never notice any size or speed change but still...

Note: I have not tested this, I just analyzed the code, but I'm not aware of any potential problems.

Cheers and Regards

Edited by bphlpt
Link to comment
Share on other sites

Inside WPI.hta I see this registry key isn't written inside the registry:

WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Download\\RunInvalidSignatures","dword:00000001","REG_DWORD");

1 - The value must be changed inside WPI.hta to (line 116):

WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Download\\RunInvalidSignatures",1,"REG_DWORD");

2 - And to restore the default value, add inside core.js (line 563):

WriteRegKey("HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Download\\RunInvalidSignatures",0,"REG_DWORD");

Regards

Link to comment
Share on other sites

I use this workaround to display the timer inside Installer.hta:

Inside timers.js

Replace function ins_iTimer() with:

Tested and works fine for me! Thanks to share your result!

*Edit: I spent days and days to find this workaround!

Wow thx..yes it works..did small test,and timer running nice en smooth.

I search oc to...but ****@#&%$#^^ nothing seems to help.(i'm no scripter).

but you did it!!!!

Very nice found men.thx

Grt Whatsup

Link to comment
Share on other sites

Thanks Watsup! ;)

Some help found here:

http://inst.eecs.ber...su02/hw/js5.htm

Test: we can save the file as HTA and launch it!

Timer.hta


<HTML>
<HEAD>
<TITLE>JavaScript Timer</TITLE>

<script LANGUAGE="JavaScript">
<!-- Beginning of JavaScript --------

var timerID=null;
var startDate;
var startSecs;

function startclock()
{
startDate=new Date();
startSecs=(startDate.getHours()*60*60) + (startDate.getMinutes()*60) + startDate.getSeconds();
showtime();
}
/* -------------------------------------------------
showtime()
Puts the amount of time that has passed since
loading the page into the field named timerField in
the form named timeForm
------------------------------------------------ */
function showtime()
{
// this doesn't work correctly at midnight...

var now=new Date();
var nowSecs=(now.getHours()*60*60) + (now.getMinutes()*60) + now.getSeconds();
var elapsedSecs=nowSecs - startSecs;

var hours=Math.floor(elapsedSecs/3600);
elapsedSecs=elapsedSecs - (hours*3600);

var minutes=Math.floor(elapsedSecs/60);
elapsedSecs=elapsedSecs - (minutes*60);

var seconds=elapsedSecs;

var timeValue="" + hours;
timeValue +=((minutes < 10) ? ":0" : ":") + minutes;
timeValue +=((seconds < 10) ? ":0" : ":") + seconds;

// Update display
document.timerForm.timerField.value=timeValue;
timerID = setTimeout("showtime()",1000);
}
// -- End of JavaScript code -------------- -->
</SCRIPT>
<META HTTP-EQUIV="Refresh" CONTENT="3600; URL=AA.html">
</HEAD>
<BODY onLoad="startclock()" BGCOLOR="#cccccc" TEXT="#000000"
LINK="#336699" VLINK="#666666" ALINK="#FF9933">

<FORM NAME="timerForm">
<FONT FACE="Arial,Helvetica" SIZE="-1"><B>You have a total of 60 minutes to complete this test. Time spent so far: </FONT>
<INPUT TYPE="text" NAME="timerField" SIZE=10 VALUE ="">
</FORM>

</HTML>

Enjoy!

Edited by myselfidem
Link to comment
Share on other sites

I am fine with either if the code works on both.

Personally I would go with the cleaner version.

@ myselfidem thank you for your fix and mod

@ bphlpt thank you for cleaning myselfidem's code up a bit.

Edited by Kelsenellenelvian
Link to comment
Share on other sites

  • 1 month later...

Hi all,

After posting on wincert a fix for my usage, I propose you the following change.

I was willing to use an IF statement as a cmd iun WPI. And it did not work.

cmds[pn]=[' "%wpipath%\\PathToExe\\MainExe.exe" /s /v/qn',
'{CMD} IF EXIST "%wpipath%\\PathToExe\\ExeFile.exe" start "Title" /WAIT "%wpipath%\\PathToExe\\ExeFile.exe" /s /v/qn'];
cond[pn]=['FileExists("%wpipath%\\PathToExe\\MainExe.exe")'];

I track done a change in installer.js (on line 1080 WPI 8.6.3)

case 'CMD': 
cmd="CMD /C " + cmd;
fsoCmd=true;
break;

As added by myselfidem, to add the possibility to choose the CMD command in WPI menu, the following changes are needed in configwizard.js

on line 363:

CommandsMenuBar.addNewChild("cmd_dos2", 11, "dos_cmd", "Cmd", false, "", "");

on line 632:

case 'dos_cmd':
HandleCommandsSelectionMenu("{CMD} ");
break;

Regards.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...