Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: CheckBox Program Install Loop

  1. #1
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

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


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: CheckBox Program Install Loop

    Please read the forum rules, most notably point 10.

  3. #3
    Junior Member
    Join Date
    Jan 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: CheckBox Program Install Loop

    Oh sorry about that.

Similar Threads

  1. install network program
    By ferrarini in forum What's Wrong With My Code?
    Replies: 32
    Last Post: May 30th, 2012, 01:05 PM
  2. See if checkbox is checked
    By kney in forum Java Theory & Questions
    Replies: 9
    Last Post: December 7th, 2011, 07:23 AM
  3. how to install the JVM?
    By warnexus in forum Java IDEs
    Replies: 3
    Last Post: September 1st, 2011, 10:33 AM
  4. how to delete record based on checkbox selected checkbox
    By -_- in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: December 15th, 2009, 09:26 PM