display an array in a msgbox

Discussion in 'Software' started by red death68, Sep 15, 2011.

  1. red death68

    red death68 Command Sergeant Major

    as you may have seen iv decided to finish my summer project of making an uninstaller. for simplicity reasons i have decided to make the msg box display an array of the options selected but im having issues making the array display so heres my code

    Code:
    <html>
      <head>
        <title>Mod Uninstaller</title>
        <HTA:APPLICATION 
             ID="Mod Uninstaller"
             APPLICATIONNAME="Mod Uninstaller"
             SCROLL="no"
             SINGLEINSTANCE="yes"
             WINDOWSTATE="maximize"
             MaximizeButton="no"
             MinimizeButton="no"
             Border="thin"
             icon="moduninstaller.ico"
        >
      </head>
    
     <SCRIPT LANGUAGE="VBScript">   
        window.resizeto 900, 544 
        sub test
            
    	dim myArray(6)
              If Sound.Checked then          
                chck1="sounds"
    			myArray(0) = "sounds"
              End If
              
              If bg.Checked Then
                myArray(1) = ", background"
    			chck2 = "bg"
              End If
              
              If bgm.Checked Then
                myArray(2) = ", background music"
    			chck3 = "bgm"
              End If
              
              If ui.Checked Then
                myArray(3) = ", user interface"
    			chck4 = "ui"
              End If
              
              If km.Checked Then
                myArray(4) = ", kill marks"
    			chck5 = "km"
              End If
    	  
    	  If msg.Checked Then
                myArray(5) = ", defualt radio messages"
    			chck6 = "msg"
    	  End If
                     
         Select Case MsgBox ("You have chosen the following"(myarray, vbCr) ,4+vbSystemModal, "CF Mod Uninstaller")
            Case vbNo
              'do nothing
    		    Case Else
    	  Set Objreg = Createobject("Wscript.shell")
              rv = objreg.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cross Fire_is1\InstallLocation")
            
    	If chck1 = " sounds" then
    	msgbox "test"
    	end if
    		  End select
        End Sub
      </script>
      
      <body background=cf.png BGPROPERTIES=FIXED>
        <div style="border:2px solid black;background:transperent;width:350px;hight:100px;padding:5px;position:absolute;top:175px;left:250px">
          <h1>Select the crossfire modifications you would like to remove.</h1>
        </div>
        <div style="position:absolute;top:360px;left:320px">
          <input type="checkbox" name="sound"> Radio Sounds<br>
          <input type="checkbox" name="bg"> Login Background<br>
          <input type="checkbox" name="bgm"> Background Music<br>
          <input type="checkbox" name="ui"> User Interface<br>
          <input type="checkbox" name="km"> Kill Marks<br>
    	  <input type="checkbox" name="msg"> Default Game Messages<br>
          <input id=runbutton  class="button" type="button" value="Run" name="run_button" onClick="test">
        </div>
      </body>
    </html>
     
  2. GermanOne

    GermanOne Guest

    You need to transform the array to a string. The Join function may help.

    Code:
    MsgBox ("You have chosen the following" & vbLf & Join(myarray, vbLf), vbYesNo + vbSystemModal, "CF Mod Uninstaller")
    
    Regards
    GermanOne
     
  3. red death68

    red death68 Command Sergeant Major

    i tried the code and it told me i cant use parentheses to call a sub i don't know whats wrong with it
     
  4. GermanOne

    GermanOne Guest

    Well, if the message is that you shouldn't use parentheses what could be wrong in this case? :-D
    Code:
    MsgBox "You have chosen the following" & vbLf & Join(myarray, vbLf), vbYesNo + vbSystemModal, "CF Mod Uninstaller"
    
    :p
     
  5. red death68

    red death68 Command Sergeant Major

    now i get line 53 character 9 expected statement (the same line as msgbox)
     
  6. GermanOne

    GermanOne Guest

    No idea.
    If you use the MsgBox function without querying the result then don't use parentheses.
    Code:
    MsgBox "Hello World", vbOKOnly, "Test"
    
    But once you retieve the result you have to use parantheses.
    Code:
    Select Case MsgBox("Are you OK", vbYesNo + vbQuestion, "Test")
      Case vbYes
        WScript.Echo "Yes"
      Case Else
        WScript.Echo "No"
    End Select
    
    Code:
    iRet = MsgBox("Are you OK", vbYesNo + vbQuestion, "Test")
    If iRet = vbYes Then
      WScript.Echo "Yes"
    Else
      WScript.Echo "No"
    End If
    
     
  7. red death68

    red death68 Command Sergeant Major

    im still toying with this i think i almost have it but im getting the error that line 52 character 20 expected a statement

    here is the code

    Code:
    <html>
      <head>
        <title>Mod Uninstaller</title>
        <HTA:APPLICATION 
             ID="Mod Uninstaller"
             APPLICATIONNAME="Mod Uninstaller"
             SCROLL="no"
             SINGLEINSTANCE="yes"
             WINDOWSTATE="maximize"
             MaximizeButton="no"
             MinimizeButton="no"
             Border="thin"
             icon="moduninstaller.ico"
        >
      </head>
    
     <SCRIPT LANGUAGE="VBScript">   
        window.resizeto 900, 544 
        sub test
        dim myString    
    	dim myArray(6)
              If Sound.Checked then          
                chck1="sounds"
    			myArray(0) = "sounds"
              End If
              
              If bg.Checked Then
                myArray(1) = ", background"
    			chck2 = "bg"
              End If
              
              If bgm.Checked Then
                myArray(2) = ", background music"
    			chck3 = "bgm"
              End If
              
              If ui.Checked Then
                myArray(3) = ", user interface"
    			chck4 = "ui"
              End If
              
              If km.Checked Then
                myArray(4) = ", kill marks"
    			chck5 = "km"
              End If
    	  
    	  If msg.Checked Then
                myArray(5) = ", defualt radio messages"
    			chck6 = "msg"
    	  End If
         myString = join(myArray)            
    Select Case MsgBox "The following have chosen the following:" &myString, vbYesNo + vbSystemModal, "CF Mod Uninstaller"
              Case vbYes
        		Set Objreg = Createobject("Wscript.shell")
        rv = objreg.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cross Fire_is1\InstallLocation")
        Case Else
        'do nothing
        End Select
        End Sub
      </script>
      
      <body background=cf.png BGPROPERTIES=FIXED>
        <div style="border:2px solid black;background:transperent;width:350px;hight:100px;padding:5px;position:absolute;top:175px;left:250px">
          <h1>Select the crossfire modifications you would like to remove.</h1>
        </div>
        <div style="position:absolute;top:360px;left:320px">
          <input type="checkbox" name="sound"> Radio Sounds<br>
          <input type="checkbox" name="bg"> Login Background<br>
          <input type="checkbox" name="bgm"> Background Music<br>
          <input type="checkbox" name="ui"> User Interface<br>
          <input type="checkbox" name="km"> Kill Marks<br>
    	  <input type="checkbox" name="msg"> Default Game Messages<br>
          <input id=runbutton  class="button" type="button" value="Run" name="run_button" onClick="test">
        </div>
      </body>
    </html>
     
  8. GermanOne

    GermanOne Guest

    Please read my former reply. In case of Select you retrieve data from the MsgBox function. For that reason you have to enclose the parameters into parantheses.

    Regards
    GermanOne
     
  9. red death68

    red death68 Command Sergeant Major

    thanks german i forgot that part thats what i get for coding so early in the morning during a java class
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds