myselfidem Posted March 10, 2013 Posted March 10, 2013 (edited) I'm looking for a workaround! Edited March 10, 2013 by myselfidem
Whatsup Posted March 17, 2013 Posted March 17, 2013 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
myselfidem Posted March 17, 2013 Posted March 17, 2013 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.
myselfidem Posted April 2, 2013 Posted April 2, 2013 (edited) I use this workaround to display the timer inside Installer.hta:Inside timers.jsReplace 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 April 4, 2013 by myselfidem
bphlpt Posted April 3, 2013 Posted April 3, 2013 (edited) 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=nulland change: timerID=setTimeout("ins_iTimer()",1000); // Update displayto: var timerID=setTimeout("ins_iTimer()",1000); // Update displayAnd 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 April 3, 2013 by bphlpt
myselfidem Posted April 3, 2013 Posted April 3, 2013 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
Whatsup Posted April 5, 2013 Posted April 5, 2013 I use this workaround to display the timer inside Installer.hta:Inside timers.jsReplace 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.thxGrt Whatsup
myselfidem Posted April 5, 2013 Posted April 5, 2013 (edited) Thanks Watsup! Some help found here:http://inst.eecs.ber...su02/hw/js5.htmTest: 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 April 5, 2013 by myselfidem
bphlpt Posted April 5, 2013 Posted April 5, 2013 LOL I guess you didn't like my shortened version for some reason?Cheers and Regards
myselfidem Posted April 5, 2013 Posted April 5, 2013 LOL I guess you didn't like my shortened version for some reason?Cheers and RegardsThanks bphlpt for your input! Let Kels make a choice for the next release!Cheers and regards.
Whatsup Posted April 5, 2013 Posted April 5, 2013 Hoi..Thx for compleet Timer.hta myselfidem.Also thanks bphlpt.Grt Whatsup
bphlpt Posted April 5, 2013 Posted April 5, 2013 Let Kels make a choice for the next release!That's very appropriate. Cheers and Regards
Kelsenellenelvian Posted April 6, 2013 Author Posted April 6, 2013 (edited) 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 April 6, 2013 by Kelsenellenelvian
myselfidem Posted April 6, 2013 Posted April 6, 2013 The two codes works fine, Kels. Tested!Thanks and Regards
gilles_gros Posted May 6, 2013 Posted May 6, 2013 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.json line 363:CommandsMenuBar.addNewChild("cmd_dos2", 11, "dos_cmd", "Cmd", false, "", "");on line 632:case 'dos_cmd': HandleCommandsSelectionMenu("{CMD} "); break;Regards.
Recommended Posts