Results 1 to 4 of 4
  1. #1
    Mike80 is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Exclamation CheckBox Program Install Loop

    HI :)

    I found this HTA script (CSS, HTML and JScript) and i modified it to my needs, but i'm stuck at the last JScript section where the script should install every selected CheckBox option one by one. Could someone please help me to script this last JScript section? My JScript skills are not that great.

    Java Code:
    <TITLE>Exemple Timer CheckBoxes</TITLE>
    <HTA:APPLICATION ID="Exemple TmChkBx"
      SCROLL="no"
      SCROLLFLAT="no"
      SINGLEINSTANCE="yes"
      SHOWINTASKBAR="yes"
      SysMenu="yes"
      MAXIMIZEBUTTON="no"
      MINIMIZEBUTTON="yes"
      BORDER="thin"
      BORDERSTYLE="complex"
      INNERBORDER="no"
      CAPTION="yes"
      WINDOWSTATE="normal"
      APPLICATIONNAME="EInstlApp"
      ICON="%SystemRoot%\explorer.exe">
    <style type="text/css">
    body {
      backGround-color:#EFE9E3;
      margin:5px;
    }
    .countdown {
      height:20px;
      font:11px;
      font-weight:bold;
      font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
      color:#001141;
      text-align:center;
      padding:4px 0px 0px 0px;
      filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr="AliceBlue",endColorStr="SeaGreen");
    }
    .button {
      height:20px;
      cursor:Hand;
      font:11px;
      font-weight:bold;
      font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
      color:#40404;
      filter:progid:DXImageTransform.Microsoft.Gradient(StartColorStr="#E5E5E5",EndColorStr="#7D7D7D");
      border:0px 0px 0px 0px transparent;
    }
    td {
      font-size:11px;
      font-weight:Bold;
      font-family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
      color:#000000;
    }
    </style>
    <script language="JScript">
    //-> Resize And Place In Approx Center
    window.resizeTo(620,420)
    window.moveTo(screen.availWidth/2-(620/2),screen.availHeight/2-(420/2))
    //-> Objects For Runtime
    var Act = new ActiveXObject("Wscript.Shell");
    var Fso = new ActiveXObject("Scripting.FileSystemObject");
    //-> Runtime Varible 
    var Tm1="";Ct=60;Cnf=false;Cbx="";Fns=false
    //-> Body OnLoad Function
    window.onload=function(){
      Countdown();
    }
    //-> Stop F5 From Closing HTA
    document.onkeydown=function(){
      if(event.keyCode==116){
        event.keyCode=0;
        event.cancelBubble=true;
        return false;
      }
    }
    //-> Countdown
    function Countdown(){
      if(Ct==0){
        DefaultAction();
        Fns=true
      }
      if(Fns==true){
        window.close();
      }
      Txt1.innerHTML="Default Action in: "+Ct+" Seconds"
      Ct = Ct - 1
      Tm1=window.setTimeout("Countdown()",1000);
    }
    //-> Function To Cancel Countdown
    function cancelcountdown(){
      Cnf=true
      window.clearTimeout(Tm1);Tm1=""
      Txt1.innerHTML="Default Action Canceled".fontcolor("#690000").bold();
    }
    //-> Default Action If Nothing Changes
    function DefaultAction(){
      window.clearInterval(Tm1);Tm1=""
      Txt1.innerHTML="Processing Default Settings".fontcolor("#003300").bold();
      submit();
    }
    //-> Toggles Disabled = True Or False = L
    function CbxOff(L){
      for(var k=0;k<CBO.length;k++){
        CBO[k].disabled=L;
      }
    }
    //-> Add Zero To A Number   
    function AZero(N,T){
      if(T>=2 && T<=3){
        N="00"+N;
        return Right(N,T);
      }else{
        return N;
      }
    }
    //-> Process Only Checked Checkboxes
    function submit(){
      CbxOff(true)
      window.clearInterval(Tm1);Tm1=""
      Txt1.innerHTML="Processing User Choices".fontcolor("#003300").bold();
    //-> THE SCRIPT PROBLEM STARTS HERE <-//
      for(var i=-1; i > CBO.length; i--){
        if(CBO[i].value==null==false && CBO[i].checked){
          P = Act.ExpandEnvironmentStrings(CBO(i).value)
          A = Act.ExpandEnvironmentStrings(CBO(i).switch)
          try{
            Act.Run(c34+P+c34+c34+A+c34" 1,true);
          }
          catch(e){
          /*Error Code For Selected But Could Not Run*/;
          }
        }
      }
    //-> THE SCRIPT PROBLEM ENDS HERE <-//
    }
    </script>
    <body onbeforeunload="window.close()">
    <table width="100%">
      <td>Select the application that you want to change from the default choice below. When The Counter reaches Zero and no choices have been change, it will run these default settings.</td>
    </table>
    <table width="100%" border="1">
      <td align="center">
        <table>
          <td>Application 1</td>
          <td><input type="checkbox" name="CBO" id="Application 1" value="%WinDir%\notepad.exe" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 2</td>
          <td><input type="checkbox" name="CBO" id="Calculator" value="%WinDir%\system32\calc.exe" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 3</td>
          <td><input type="checkbox" name="CBO" id="Application 3" value="%SystemDrive%\temp\Program1.exe" switch="/silent /norestart /LoadInf="%SystemDrive%\temp\Program1.ini"" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 4</td>
          <td><input type="checkbox" name="CBO" id="Application 4" value="Checkbox 4 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 5</td>
          <td><input type="checkbox" name="CBO" id="Application 5" value="Checkbox 5 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 6</td>
          <td><input type="checkbox" name="CBO" id="Application 6" value="Checkbox 6 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 7</td>
          <td><input type="checkbox" name="CBO" id="Application 7" value="Checkbox 7 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 8</td>
          <td><input type="checkbox" name="CBO" id="Application 8" value="Checkbox 8 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 9</td>
          <td><input type="checkbox" name="CBO" id="Application 9" value="Checkbox 9 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 10</td>
          <td><input type="checkbox" name="CBO" id="Application 10" value="Checkbox 10 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
      </td>
      <td align="center">
        <table>
          <td>Application 11</td>
          <td><input type="checkbox" name="CBO" id="Application 11" value="Checkbox 11 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 12</td>
          <td><input type="checkbox" name="CBO" id="Application 12" value="Checkbox 12 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 13</td>
          <td><input type="checkbox" name="CBO" id="Application 13" value="Checkbox 13 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 14</td>
          <td><input type="checkbox" name="CBO" id="Application 14" value="Checkbox 14 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 15</td>
          <td><input type="checkbox" name="CBO" id="Application 15" value="Checkbox 15 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 16</td>
          <td><input type="checkbox" name="CBO" id="Application 16" value="Checkbox 16 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 17</td>
          <td><input type="checkbox" name="CBO" id="Application 17" value="Checkbox 17 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 18</td>
          <td><input type="checkbox" name="CBO" id="Application 18" value="Checkbox 18 Selected" switch="" onclick="cancelcountdown()" checked></input></td>
        </table>
        <table>
          <td>Application 19</td>
          <td><input type="checkbox" name="CBO" id="Application 19" value="Checkbox 19 Selected" switch="" onclick="cancelcountdown()"></input></td>
        </table>
        <table>
          <td>Application 20</td>
          <td><input type="checkbox" name="CBO" id="Application 20" value="Checkbox 20 Selected" switch="" onclick="cancelcountdown()"></input></td>
        </table>
      </td>
    </table>
    <table>
      <tr>
        <td><div id="Txt1" class="countdown" Style="margin:10px 0px 0px 4px;width:180px;"></div></td>
        <td>
        <button type="button" id="button1" class="button" Style="margin:10px 0px 0px 2px;width:120px;" onclick="cancelcountdown()">Cancel Countdown</button>
        <button type="button" id="button2" class="button" Style="margin:10px 0px 0px 20px;width:100px;" onclick="submit()">Submit</button>
        <button type="button" id="button3" class="button" Style="margin:10px 0px 0px 20px;width:80px;" onclick="window.close()">Quit</button>
        </td>
      </tr>
    </table>
    </body>
    Last edited by Mike80; 01-14-2013 at 08:48 AM.

  2. #2
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: CheckBox Program Install Loop

    Wrong forum... try a HTML forum, not a Java forum.
    I like likes!

  3. #3
    Mike80 is offline Member
    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Default Re: CheckBox Program Install Loop

    But this is a Java code problem?

  4. #4
    Sierra is offline AN21XX
    Join Date
    Mar 2012
    Location
    Munich
    Posts
    297
    Rep Power
    3

    Default Re: CheckBox Program Install Loop

    I do not see any Java in there... I hope you don't think that JavaScript is related to Java.
    Maybe you get lucky and soemone knows what your problem is... who can tell? ;)
    I like likes!

Similar Threads

  1. My Checkbox program is not working properly
    By newbie106 in forum New To Java
    Replies: 8
    Last Post: 08-17-2012, 09:44 PM
  2. Need help with program using For loop
    By .Tyler in forum New To Java
    Replies: 0
    Last Post: 10-20-2011, 08:02 PM
  3. Replies: 0
    Last Post: 09-23-2011, 05:15 PM
  4. loop program
    By javanovoice in forum New To Java
    Replies: 12
    Last Post: 09-09-2011, 03:01 AM
  5. Replies: 3
    Last Post: 07-27-2010, 09:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •