IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VBScript Discussion :

[HTA] Affichage dynamique selon liste de choix


Sujet :

VBScript

  1. #1
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2011
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Novembre 2011
    Messages : 163
    Points : 304
    Points
    304
    Par défaut [HTA] Affichage dynamique selon liste de choix
    Bonjour à tous,

    J'aimerais pouvoir apporter une information aux utilisateurs selon le choix en cours dans une liste de choix.
    Je ne sais ni comment m'y prendre, ni si cela est possible ...

    Pour mieux comprendre, n'hésitez pas à exécuter le code HTA ci-dessous, il ne fait rien pour l'instant ...
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    APPLICATION="OUTILS"
    ICON="outils.ico"
    BORDER="thin"
    SCROLL="no"
    SINGLEINSTANCE="no"
    WINDOWSTATE="normal">
    </head>
    <script language="VBScript">
     
    Sub Window_onLoad
    Me.ResizeTo 400,400
    Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 200)
    End Sub
     
    Sub Operate_OnClick
    End Sub
     
    </script>
     
    <body STYLE="font:12 pt calibri; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
    (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">
     
    <p align="center">OUTILS</p><br></br>
     
    <p align="center">Que voulez-vous faire ?<br></br>
    <SELECT NAME="Operation" SIZE=1>
    <OPTION VALUE="Sauvegarder">Sauvegarder votre configuration
    <OPTION VALUE="Restaurer">Restaurer une configuration
    <OPTION VALUE="Reinitialiser">Réinitialiser la configuration
    <OPTION VALUE="Verifier">Vérifier la configuration
     
    </SELECT></p>
    <br></br>
     
    <p align="center">ici une information dynamique<br></br>selon le choix effectué au dessus<br></br>
    <br></br>
     
    <p align="center"><input type="button" value=" OK " name="Operate"></p>
    </body>
    Merci d'avance pour vos avis et conseils (d'autres solutions envisageables peut-être ?)
    Bonne journée !

  2. #2
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Voici un super HTA qui vous donne une multitude de solutions trouvé dans un forum anglais
    Et il génère aussi du code source vbscript et HTML
    Enregistrez sous HTAInput.hta
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
     <HTML>
      <HEAD>
      <TITLE>Input Types</TITLE>
          <HTA:APPLICATION
          Application ID = "InputTypes"
          APPLICATIONNAME = "InputTypes"
          BORDER = "Thick"
          BORDERSTYLE = "Complex"
          CAPTION = "Yes"
          CONTEXTMENU = "no"
          ICON = ""
          INNERBORDER = "yes"
          MAXIMIZEBUTTON = "yes"
          MINIMIZEBUTTON = "yes"
          NAVIGABLE = "Yes"
          SCROLL = "No"
          SCROLLFLAT = "Yes"
          SELECTION = "No"
          SHOWINTASKBAR = "Yes"
          SINGLEINSTANCE = "No"
          SYSMENU = "yes"
          VERSION = "1.0"
          WINDOWSTATE = "Normal"
          />
      </HEAD>
      <!-- GradientType=0 - Top to Bottom, GradientType=1 - Left to Right -->
      <BODY STYLE="font:9pt arial; color:#000000; filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#ddd7ff', EndColorStr='#006d9f')">
        <SCRIPT LANGUAGE="VBScript">
     
      Dim fso, oFile, Source
          Set fso = CreateObject("Scripting.FileSystemObject")
          Set objShell = CreateObject("WScript.Shell")
      '<!--#################[ Set Dialog Size and Position ]######################-->
          Sub StartUp()
              Dim x,y
              x = (window.screen.width - 900) / 2
              y = (window.screen.height - 910) / 2
              If x < 0 Then x = 0
              If y < 0 Then y = 0
              window.resizeTo 900,910
              window.moveTo x,y
          End Sub
          StartUp
     
      '<!--#####################[ Submit Text ]##########################-->
          Sub SubmitText
              MsgBox "You Entered" & vbcrlf & txt.value, 64,"Text Input"
          End Sub 'SubmitText
     
      '<!--#####################[ Submit Text Area ]#####################-->
          Sub Submitarea
          Set oFile = fso.OpenTextFile( "TextArea.txt",8,true)
              sTxtarea = document.all("Txtarea").Value
              oFIle.Write sTxtarea & vbCRLF
              MsgBox "Your text has been added to TextArea.txt", 64,"Textarea Input"
          oFile.close
          End Sub 'Submitarea
          Sub OpenTxtArea
              ShellRun = objShell.Run ("%comspec% /c Start Notepad TextArea.txt", 0, 1)
          End Sub 'OpenTxtArea
     
     
      '<!--#######################[ Radio Button ]#######################-->
          Sub CheckRadio
              If rbtn(0).Checked Then
              MsgBox "You Selected Option 1", 64,"Radio Button"
              End If
     
              If rbtn(1).Checked Then
              MsgBox "You Selected Option 2", 64,"Radio Button"
              End If
     
              If rbtn(2).Checked Then
              MsgBox "You Selected Option 3", 64,"Radio Button"
              End If
          End Sub 'CheckRadio
     
      '<!--#######################[ Checkbox ]#######################-->
          Sub CheckChkBx
            Set CBForm = Document.ChkBoxFrm
             If CBForm.ChkBx1.Checked Then ChkBx1 = CBForm.ChkBx1.Value & VBCRLF
             If CBForm.ChkBx2.Checked Then ChkBx2 = CBForm.ChkBx2.Value & VBCRLF
             If CBForm.ChkBx3.Checked Then ChkBx3 = CBForm.ChkBx3.Value
                 WhatsChecked = ChkBx1 & ChkBx2 & ChkBx3
             If WhatsChecked = "" Then
                 MsgBox "You Didn't Select Anything", 64,"Checkbox Selections"
                 Else
              MsgBox "You Selected:" & vbcrlf & WhatsChecked, 64,"Checkbox Selections"
             End If
     
          ChkBx1 = ""
          ChkBx2 = ""
          ChkBx3 = ""
          End Sub 'CheckChkBx
     
      '<!--#######################[ Dropdown Menu OnChange ]#######################-->
          Sub RunDropChange
              Msgbox "You Selected Option" & " " & DropDown1.Value, 64,"Dropdown Menu OnChange"
          End Sub 'RunDropChange
     
      '<!--#######################[ Dropdown Menu OnClick ]#######################-->
          Sub RunDropClick
              Msgbox "You Selected Option" & " " & DropDown2.Value, 64,"Dropdown Menu OnClick"
          End Sub 'RunDropClick
     
      '<!--#######################[ Listbox Menu OnChange ]#######################-->
          Sub RunList
              Msgbox "You Selected Option" & " " & Listbox1.Value, 64,"Listbox Menu OnChange"
          End Sub
     
      '<!--#######################[ Multi-Select Listbox Menu ]#######################-->
          Sub RunMultiList
              For i = 0 to (MultiListBox.Options.Length - 1)
                  If (MultiListBox.Options(i).Selected) Then
                      strChoices = strChoices  & "Option " & MultiListBox.Options(i).Value & vbcrlf
                  End If
              Next
              Msgbox "You Selected:" & vbcrlf & strChoices, 64,"Multi-Select ListBox Menu"
          End Sub 'RunMultiList
     
     
      '<!--#######################[ Listbox Menu From File ]#######################-->
          Sub Window_Onload
              ForReading = 1
              strNewFile = "Phrases.txt"
              Set objFSO = CreateObject("Scripting.FileSystemObject")
              Set File = objFSO.CreateTextFile(strNewFile)
              File.writeline("Test1" & VbCrLf & "Test2" & VbCrLf & "Test3" & VbCrLf & "Test4" & VbCrLf & "Test5")
              File.Close
              Set objFile = objFSO.OpenTextFile _
                  (strNewFile, ForReading)
              Do Until objFile.AtEndOfStream
                  strLine = objFile.ReadLine
                  Set objOption = Document.createElement("OPTION")
                  objOption.Text = strLine
                  objOption.Value = strLine
                  AvailablePhrases.Add(objOption)
              Loop
              objFile.Close
          End Sub
     
          Sub onthefly
              Selection = AvailablePhrases.Value
              MsgBox "You Selected:" & VBCRLF & Selection, 64,"On-The-Fly List Box"
          End Sub 'onthefly
          Sub OpenPhrases
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Phrases.txt", 0, 1)
          End Sub '
      '<!--#######################[ Browse for File ]#######################-->
          Sub Readfile
           sFile = datafile.Value
           If sFile = "" Then
              MsgBox "Select a File First.      ", 64,"Browse for File"
           Else
              ShellRun = objShell.Run ("%comspec% /c Start Notepad "& sFile, 0, 1)
          End If
          End Sub 'Readfile
     
      '<!--###############[ View Source for Each Input Type ]###############-->
          Sub Source1
           Set Source = fso.CreateTextFile("Source.txt", True)
              Source.WriteLine ("Source For Text Input")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub SubmitText")
              Source.WriteLine ("MsgBox "& chr(34) &"You Entered"& chr(34) &" & vbcrlf & txt.value, 64, "& chr(34) &"Text Input"& chr(34) &"  ")
              Source.WriteLine ("End Sub 'SubmitText")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<input type="& chr(34) &"text"& chr(34) &" style="& chr(34) &"background-color:#ffb7d6"& chr(34) &" size="& chr(34) &"16"& chr(34) &" name="& chr(34) &"txt"& chr(34) &" value="& chr(34) &"Enter text here"& chr(34) &">")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" value="& chr(34) &"Submit"& chr(34) &" onclick="& chr(34) &"SubmitText"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source1
     
          Sub Source2
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Textarea Input")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Dim fso, oFile")
              Source.WriteLine ("Set fso = CreateObject("& chr(34) &"Scripting.FileSystemObject"& chr(34) &")")
              Source.WriteLine ("Set objShell = CreateObject("& chr(34) &"WScript.Shell"& chr(34) &") ")
              Source.WriteLine ("")
              Source.WriteLine ("Sub Submitarea")
              Source.WriteLine ("Set oFile = fso.OpenTextFile( "& chr(34) &"TextArea.txt"& chr(34) &",8,true)")
              Source.WriteLine ("sTxtarea = document.all("& chr(34) &"Txtarea"& chr(34) &").Value")
              Source.WriteLine ("oFIle.Write sTxtarea & vbCRLF")
              Source.WriteLine ("MsgBox "& chr(34) &"Your text has been added to TextArea.txt"& chr(34) &", 64,"& chr(34) &"Textarea Input"& chr(34) &"")
              Source.WriteLine ("oFile.close")
              Source.WriteLine ("End Sub 'Submitarea")
              Source.WriteLine ("Sub OpenTxtArea")
              Source.WriteLine ("ShellRun = objShell.Run ("& chr(34) &"%comspec% /c Start Notepad TextArea.txt"& chr(34) &", 0, 1)")
              Source.WriteLine ("End Sub 'OpenTxtArea")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<form method="& chr(34) &"POST"& chr(34) &">")
              Source.WriteLine ("<TEXTAREA style="& chr(34) &"")
              Source.WriteLine ("Height:193;")
              Source.WriteLine ("Width:100%;")
              Source.WriteLine ("font-Size:12;")
              Source.WriteLine ("color:#000000;")
              Source.WriteLine ("background-color:#ffffe7;")
              Source.WriteLine ("font-weight:normal;")
              Source.WriteLine ("font-family:MS Sans Serif"& chr(34) &" ")
              Source.WriteLine ("TITLE="& chr(34) &""& chr(34) &" ")
              Source.WriteLine ("NAME=Txtarea TABORDER=2 WRAP=PHYSICAL>The contents of this text area will be written to TextArea.txt when you click submit.</TEXTAREA>")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" value="& chr(34) &"Submit"& chr(34) &" onclick="& chr(34) &"Submitarea"& chr(34) &">")
              Source.WriteLine ("<input type="& chr(34) &"reset"& chr(34) &" value="& chr(34) &"Reset"& chr(34) &">")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" value="& chr(34) &"Open"& chr(34) &" onclick="& chr(34) &"OpenTxtArea"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source2
     
          Sub Source3
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Radio Button Input")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub CheckRadio")
              Source.WriteLine ("If rbtn(0).Checked Then")
              Source.WriteLine ("MsgBox "& chr(34) &"You Selected Option 1"& chr(34) &", 64,"& chr(34) &"Radio Button"& chr(34) &"")
              Source.WriteLine ("End If")
              Source.WriteLine ("")
              Source.WriteLine ("If rbtn(1).Checked Then")
              Source.WriteLine ("MsgBox "& chr(34) &"You Selected Option 2"& chr(34) &", 64,"& chr(34) &"Radio Button"& chr(34) &"")
              Source.WriteLine ("End If")
              Source.WriteLine ("")
              Source.WriteLine ("If rbtn(2).Checked Then")
              Source.WriteLine ("MsgBox "& chr(34) &"You Selected Option 3"& chr(34) &", 64,"& chr(34) &"Radio Button"& chr(34) &"")
              Source.WriteLine ("End If")
              Source.WriteLine ("")
              Source.WriteLine ("End Sub 'CheckRadio")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Radio Button</I></B></FONT><BR>")
              Source.WriteLine ("<font color="& chr(34) &"#000000"& chr(34) &"><i><fieldset><legend>Select One</legend></i></font>")
              Source.WriteLine ("<input type="& chr(34) &"radio"& chr(34) &" style="& chr(34) &"background-color:#ff0000"& chr(34) &" checked name="& chr(34) &"rbtn"& chr(34) &" value="& chr(34) &"0"& chr(34) &">Option 1")
              Source.WriteLine ("<input type="& chr(34) &"radio"& chr(34) &" style="& chr(34) &"background-color:#ffff00"& chr(34) &" name="& chr(34) &"rbtn"& chr(34) &" value="& chr(34) &"1"& chr(34) &">Option 2")
              Source.WriteLine ("<input type="& chr(34) &"radio"& chr(34) &" style="& chr(34) &"background-color:#00ff00"& chr(34) &" name="& chr(34) &"rbtn"& chr(34) &" value="& chr(34) &"2"& chr(34) &">Option 3")
              Source.WriteLine ("<INPUT STYLE="& chr(34) &"filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#a1ff97', EndColorStr='#009f00')"& chr(34) &" type="& chr(34) &"Button"& chr(34) &" Value="& chr(34) &"Check"& chr(34) &"  onclick="& chr(34) &"CheckRadio"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source3
     
          Sub Source4
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Checkbox Input")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub CheckChkBx")
              Source.WriteLine ("  Set CBForm = Document.ChkBoxFrm")
              Source.WriteLine ("   If CBForm.ChkBx1.Checked Then ChkBx1 = CBForm.ChkBx1.Value & VBCRLF")
              Source.WriteLine ("   If CBForm.ChkBx2.Checked Then ChkBx2 = CBForm.ChkBx2.Value & VBCRLF")
              Source.WriteLine ("   If CBForm.ChkBx3.Checked Then ChkBx3 = CBForm.ChkBx3.Value")
              Source.WriteLine ("   WhatsChecked = ChkBx1 & ChkBx2 & ChkBx3")
              Source.WriteLine ("   If WhatsChecked = "& chr(34) &""& chr(34) &" Then")
              Source.WriteLine ("   MsgBox "& chr(34) &"You Didn't Select Anything"& chr(34) &", 64,"& chr(34) &"Checkbox Selections"& chr(34) &"")
              Source.WriteLine ("   Else")
              Source.WriteLine ("MsgBox "& chr(34) &"You Selected:"& chr(34) &" & vbcrlf & WhatsChecked, 64,"& chr(34) &"Checkbox Selections"& chr(34) &"")
              Source.WriteLine ("   End If")
              Source.WriteLine ("ChkBx1 = "& chr(34) &""& chr(34) &"")
              Source.WriteLine ("ChkBx2 = "& chr(34) &""& chr(34) &"")
              Source.WriteLine ("ChkBx3 = "& chr(34) &""& chr(34) &"")
              Source.WriteLine ("End Sub 'CheckChkBx")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Check-Box</I></B></FONT><BR>")
              Source.WriteLine ("<font color="& chr(34) &"#000000"& chr(34) &"><i><fieldset><legend>Select One or More</legend></i></font>")
              Source.WriteLine ("<input style="& chr(34) &"background-color:#00ff00"& chr(34) &" name="& chr(34) &"ChkBx1"& chr(34) &" Checked value="& chr(34) &"Box1"& chr(34) &" type="& chr(34) &"checkbox"& chr(34) &">CheckBox 1")
              Source.WriteLine ("<input style="& chr(34) &"background-color:#ffff00"& chr(34) &" name="& chr(34) &"ChkBx2"& chr(34) &" value="& chr(34) &"Box2"& chr(34) &" type="& chr(34) &"checkbox"& chr(34) &">CheckBox 2")
              Source.WriteLine ("<input style="& chr(34) &"background-color:#ff0000"& chr(34) &" name="& chr(34) &"ChkBx3"& chr(34) &" value="& chr(34) &"Box3"& chr(34) &" type="& chr(34) &"checkbox"& chr(34) &">CheckBox 3")
              Source.WriteLine ("<INPUT STYLE="& chr(34) &"filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#8ff2ff', EndColorStr='#008785')"& chr(34) &" type="& chr(34) &"Button"& chr(34) &" Value="& chr(34) &"Check"& chr(34) &"  onclick="& chr(34) &"CheckChkBx"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source4
     
          Sub Source5
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Drop Down Menu onChange")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub RunDropChange")
              Source.WriteLine ("Msgbox "& chr(34) &"You Selected Option"& chr(34) &" & "& chr(34) &" "& chr(34) &" & DropDown1.Value, 64,"& chr(34) &"Dropdown Menu OnChange"& chr(34) &"")
              Source.WriteLine ("End Sub 'RunDropChange")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Drop Down Menu onChange</I></B></FONT><BR>")
              Source.WriteLine ("<select size="& chr(34) &"1"& chr(34) &" name="& chr(34) &"DropDown1"& chr(34) &" onChange="& chr(34) &"RunDropChange"& chr(34) &">")
              Source.WriteLine ("<option>Choose One&nbsp&nbsp&nbsp&nbsp&nbsp</option>")
              Source.WriteLine ("<option value="& chr(34) &"1"& chr(34) &">onChange Option 1</option>")
              Source.WriteLine ("<option value="& chr(34) &"2"& chr(34) &">onChange Option 2</option>")
              Source.WriteLine ("<option value="& chr(34) &"3"& chr(34) &">onChange Option 3</option>")
              Source.WriteLine ("<option value="& chr(34) &"4"& chr(34) &">onChange Option 4</option>")
              Source.WriteLine ("</select>")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source5
     
          Sub Source6
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Drop Down Menu onClick")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub RunDropClick")
              Source.WriteLine ("Msgbox "& chr(34) &"You Selected Option"& chr(34) &" & "& chr(34) &" "& chr(34) &" & DropDown2.Value, 64,"& chr(34) &"Dropdown Menu OnClick"& chr(34) &"")
              Source.WriteLine ("End Sub 'RunDropClick")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Drop Down Menu onClick</I></B></FONT><BR>")
              Source.WriteLine ("<select size="& chr(34) &"1"& chr(34) &" name="& chr(34) &"DropDown2"& chr(34) &">")
              Source.WriteLine ("<option value="& chr(34) &"1"& chr(34) &">OnClick Option 1&nbsp&nbsp&nbsp&nbsp&nbsp</option>")
              Source.WriteLine ("<option value="& chr(34) &"2"& chr(34) &">OnClick Option 2</option>")
              Source.WriteLine ("<option value="& chr(34) &"3"& chr(34) &">OnClick Option 3</option>")
              Source.WriteLine ("<option value="& chr(34) &"4"& chr(34) &">OnClick Option 4</option>")
              Source.WriteLine ("</select>")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" onClick="& chr(34) &"RunDropClick"& chr(34) &" value="& chr(34) &"Submit"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source6
     
          Sub Source7
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Listbox Menu OnChange")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub RunList")
              Source.WriteLine ("Msgbox "& chr(34) &"You Selected Option"& chr(34) &" & "& chr(34) &" "& chr(34) &" & Listbox1.Value, 64,"& chr(34) &"Listbox Menu OnChange"& chr(34) &"")
              Source.WriteLine ("End Sub")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Select an Option:</I></B></FONT><BR>")
              Source.WriteLine ("<select size="& chr(34) &"4"& chr(34) &" name="& chr(34) &"Listbox1"& chr(34) &" onChange="& chr(34) &"RunList"& chr(34) &">")
              Source.WriteLine ("<option value="& chr(34) &"1"& chr(34) &">Listbox Option 1&nbsp&nbsp&nbsp&nbsp&nbsp</option>")
              Source.WriteLine ("<option value="& chr(34) &"2"& chr(34) &">Listbox Option 2</option>")
              Source.WriteLine ("<option value="& chr(34) &"3"& chr(34) &">Listbox Option 3</option>")
              Source.WriteLine ("<option value="& chr(34) &"4"& chr(34) &">Listbox Option 4</option>")
              Source.WriteLine ("</select>")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source7
     
          Sub Source8
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Multi-Select ListBox Menu")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub RunMultiList")
              Source.WriteLine ("For i = 0 to (MultiListBox.Options.Length - 1)")
              Source.WriteLine ("If (MultiListBox.Options(i).Selected) Then")
              Source.WriteLine ("strChoices = strChoices  & "& chr(34) &"Option "& chr(34) &" & MultiListBox.Options(i).Value & vbcrlf")
              Source.WriteLine ("End If")
              Source.WriteLine ("Next")
              Source.WriteLine ("Msgbox "& chr(34) &"You Selected:"& chr(34) &" & vbcrlf & strChoices, 64,"& chr(34) &"Multi-Select ListBox Menu"& chr(34) &"")
              Source.WriteLine ("End Sub 'RunMultiList")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Use Ctrl to Select Multiple Options:</I></B></FONT><BR>")
              Source.WriteLine ("<select size="& chr(34) &"4"& chr(34) &" name="& chr(34) &"MultiListBox"& chr(34) &" multiple>")
              Source.WriteLine ("<option value="& chr(34) &"1"& chr(34) &">MultiListBox Option 1</option>")
              Source.WriteLine ("<option value="& chr(34) &"2"& chr(34) &">MultiListBox Option 2</option>")
              Source.WriteLine ("<option value="& chr(34) &"3"& chr(34) &">MultiListBox Option 3</option>")
              Source.WriteLine ("<option value="& chr(34) &"4"& chr(34) &">MultiListBox Option 4</option>")
              Source.WriteLine ("</select>")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source8
     
          Sub Source9
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Drop Down Menu From File")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("Sub Window_Onload")
              Source.WriteLine ("    ForReading = 1")
              Source.WriteLine ("    strNewFile = "& chr(34) &"Phrases.txt"& chr(34) &"")
              Source.WriteLine ("    Set objFSO = CreateObject("& chr(34) &"Scripting.FileSystemObject"& chr(34) &")")
              Source.WriteLine ("    Set objFile = objFSO.OpenTextFile _")
              Source.WriteLine ("        (strNewFile, ForReading)")
              Source.WriteLine ("    Do Until objFile.AtEndOfStream")
              Source.WriteLine ("        strLine = objFile.ReadLine")
              Source.WriteLine ("        Set objOption = Document.createElement("& chr(34) &"OPTION"& chr(34) &")")
              Source.WriteLine ("        objOption.Text = strLine")
              Source.WriteLine ("        objOption.Value = strLine")
              Source.WriteLine ("        AvailablePhrases.Add(objOption)")
              Source.WriteLine ("    Loop")
              Source.WriteLine ("    objFile.Close")
              Source.WriteLine ("End Sub")
              Source.WriteLine ("")
              Source.WriteLine ("Sub onthefly")
              Source.WriteLine ("    Selection = AvailablePhrases.Value")
              Source.WriteLine ("MsgBox "& chr(34) &"You Selected:"& chr(34) &" & VBCRLF & Selection, 64,"& chr(34) &"On-The-Fly List Box"& chr(34) &"")
              Source.WriteLine ("End Sub 'onthefly")
              Source.WriteLine ("Sub OpenPhrases")
              Source.WriteLine ("ShellRun = objShell.Run ("& chr(34) &"%comspec% /c Start Notepad Phrases.txt"& chr(34) &", 0, 1)")
              Source.WriteLine ("End Sub '")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Drop Down Menu From File</I></B></FONT><BR>")
              Source.WriteLine ("<select size="& chr(34) &"1"& chr(34) &" name="& chr(34) &"AvailablePhrases"& chr(34) &">")
              Source.WriteLine ("<option>&nbsp&nbsp</option>")
              Source.WriteLine ("</select>")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" onClick="& chr(34) &"onthefly"& chr(34) &" value="& chr(34) &"Submit"& chr(34) &">")
              Source.WriteLine ("<input type="& chr(34) &"button"& chr(34) &" value="& chr(34) &"Open"& chr(34) &" onclick="& chr(34) &"OpenPhrases"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source9
     
          Sub Source10
           Set Source = fso.CreateTextFile("Source.txt", True)
               Source.WriteLine ("Source For Drop Down Menu From File")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ VBScript Source ]==--==--")
              Source.WriteLine ("    Sub Readfile")
              Source.WriteLine ("     sFile = datafile.Value")
              Source.WriteLine ("     If sFile = "& chr(34) &""& chr(34) &" Then")
              Source.WriteLine ("        MsgBox "& chr(34) &"Select a File First.      "& chr(34) &", 64,"& chr(34) &"Browse for File"& chr(34) &"")
              Source.WriteLine ("     Else")
              Source.WriteLine ("        ShellRun = objShell.Run ("& chr(34) &"%comspec% /c Start Notepad "& chr(34) &"& sFile, 0, 1)")
              Source.WriteLine ("    End If")
              Source.WriteLine ("    End Sub 'Readfile")
              Source.WriteLine ("")
              Source.WriteLine ("--==--==[ HTML Source ]==--==--")
              Source.WriteLine ("<FONT SIZE=2><B><I>Please specify a text file To Open:</I></B></FONT><BR>")
              Source.WriteLine ("<input type="& chr(34) &"file"& chr(34) &" style="& chr(34) &"background-color:#ffb7d6"& chr(34) &" name="& chr(34) &"datafile"& chr(34) &" size="& chr(34) &"25"& chr(34) &">")
              Source.WriteLine ("<input type="& chr(34) &"submit"& chr(34) &" onClick="& chr(34) &"Readfile"& chr(34) &" value="& chr(34) &"Open File"& chr(34) &">")
              Source.Close
              ShellRun = objShell.Run ("%comspec% /c Start Notepad Source.txt", 0, 1)
          End Sub 'Source10
      '<!--#############################[ Quit ]#############################-->
        Sub Quit_onclick
          Window.Close
        End Sub
     
       </SCRIPT>
     
      <TABLE width="100%" border=1>
      <TR>
      <TD>
     
      <!--==--==--==--==--==--==--==--==-- Text Types --==--==--==--==--==--==--==-->
      <TABLE Width="100%" border="1">
          <TR>
             <TD  STYLE="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=1, StartColorStr='#fffa28', EndColorStr='#ffa420')">
     
      <b>boldface text</b>&nbsp <i>italic text</i>&nbsp <u>underlined text</u><br>regular script &nbsp<sub>sub script</sub>&nbsp <sup>super script</sup>&nbsp&nbsp<TT>Typewriter Text</TT><br>This &nbsp;&nbsp; text &nbsp;&nbsp; is &nbsp;&nbsp; separated &nbsp;&nbsp; by &nbsp;&nbsp; blank &nbsp;&nbsp; spaces.
     
             </TD>
          </TR>
      </TABLE>
      <BR>
      <!--==--==--==--==--==--==--==--==-- Text Input --==--==--==--==--==--==--==-->
      <CENTER>
      <TABLE Width="100%" border="1">
          <TR>
              <TD bgcolor="#28ffbc">
              <FONT SIZE=2><B><I>Text Input</I></B></FONT><BR>
              <CENTER>
              <input type="text" style="background-color:#ffb7d6" size="16" name="txt" value="Enter text here">&nbsp
              <input type="button" value="Submit" onclick="SubmitText">
              <input type="button" value="Source" onclick="Source1">
              </CENTER>
              </TD>
          </TR>
      </TABLE>
     
      <!--==--==--==--==--==--==--==--==-- Textarea Input --==--==--==--==--==--==--==-->
      <HR>
      <TABLE Width="100%" border="1">
          <TR>
              <TD bgcolor="#28ffbc">
              <FONT SIZE=2><B><I>Textarea Input</I></B></FONT><BR>
              <CENTER>
              <form method="POST">
                  <TEXTAREA style="
                      Height:193;
                      Width:100%;
                      font-Size:12;
                      color:#000000;
                      background-color:#ffffe7;
                      font-weight:normal;
                      font-family:MS Sans Serif"
                         TITLE=""
                         NAME=Txtarea TABORDER=2 WRAP=PHYSICAL>The contents of this text area will be written to TextArea.txt when you click submit.</TEXTAREA>
          <TR>
              <TD bgcolor="#28ffbc">
              <CENTER>
              <input type="button" value="Submit" onclick="Submitarea">
              <input type="reset" value="Reset">
              <input type="button" value="Open" onclick="OpenTxtArea">
              <input type="button" value="Source" onclick="Source2">
              </CENTER>
              </TD>
          </TR>
              </CENTER>
              </TD>
          </TR>
      </TABLE>
     
      <!--==--==--==--==--==--==--==--==-- Radio Button --==--==--==--==--==--==--==-->
      <HR>
      <TABLE Width="100%" border="0">
        <TR>
          <TD>
          <FONT SIZE=2><B><I>Radio Button</I></B></FONT><BR>
      <font color="#000000"><i><fieldset><legend>Select One</legend></i></font>
          <CENTER>
          <input type="radio" style="background-color:#ff0000" checked name="rbtn" value="0">Option 1
          <input type="radio" style="background-color:#ffff00" name="rbtn" value="1">Option 2
          <input type="radio" style="background-color:#00ff00" name="rbtn" value="2">Option 3
          <BR>
          <BR>
          <INPUT STYLE="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#a1ff97', EndColorStr='#009f00')" type="Button" Value="Check"  onclick="CheckRadio">
          <input type="button" value="Source" onclick="Source3">
          </CENTER>
          </TD>
        </TR>
      </TABLE>
     
      <!--==--==--==--==--==--==--==--==-- Checkbox --==--==--==--==--==--==--==-->
      <HR>
      <TABLE Width="100%" border="0">
        <TR>
          <TD>
          <Form Name=ChkBoxFrm>
              <FONT SIZE=2><B><I>Check-Box</I></B></FONT><BR>
      <font color="#000000"><i><fieldset><legend>Select One or More</legend></i></font>
          <CENTER>
          <input style="background-color:#00ff00" name="ChkBx1" Checked value="Box1" type="checkbox">CheckBox 1
          <input style="background-color:#ffff00" name="ChkBx2" value="Box2" type="checkbox">CheckBox 2
          <input style="background-color:#ff0000" name="ChkBx3" value="Box3" type="checkbox">CheckBox 3
          <BR>
          <BR>
          <INPUT STYLE="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#8ff2ff', EndColorStr='#008785')" type="Button" Value="Check"  onclick="CheckChkBx">
          <input type="button" value="Source" onclick="Source4">
          </CENTER>
          </Form>
          </TD>
        </TR>
      </TABLE>
     
      <!--==--==--==--==--==--==--= Beginning of Right Side =--==--==--==--==--==-->
      <!--==--==--==--==--==--==--==-- DropMenu OnChange --==--==--==--==--==--==-->
     
      <TD>
      <FONT SIZE=2><B><I>Drop Down Menu onChange</I></B></FONT><BR>
      <select size="1" name="DropDown1" onChange="RunDropChange">
      <option>Choose One&nbsp&nbsp&nbsp&nbsp&nbsp</option>
      <option value="1">onChange Option 1</option>
      <option value="2">onChange Option 2</option>
      <option value="3">onChange Option 3</option>
      <option value="4">onChange Option 4</option>
      </select>
      <input type="button" value="Source" onclick="Source5">
      <HR>
      <!--==--==--==--==--==--==--==-- DropMenu OnClick --==--==--==--==--==--==-->
     
      <BR>
      <FONT SIZE=2><B><I>Drop Down Menu onClick</I></B></FONT><BR>
      <select size="1" name="DropDown2">
      <option value="1">OnClick Option 1&nbsp&nbsp&nbsp&nbsp&nbsp</option>
      <option value="2">OnClick Option 2</option>
      <option value="3">OnClick Option 3</option>
      <option value="4">OnClick Option 4</option>
      </select>
      <BR>
      <BR>
      <CENTER>
      <input type="button" onClick="RunDropClick" value="Submit">
      <input type="button" value="Source" onclick="Source6">
      </CENTER>
      <HR>
      <!--==--==--==--==--==--==--==-- Listbox OnChange --==--==--==--==--==--==-->
      <FONT SIZE=2><B><I>Select an Option:</I></B></FONT><BR>
      <select size="4" name="Listbox1" onChange="RunList">
      <option value="1">Listbox Option 1&nbsp&nbsp&nbsp&nbsp&nbsp</option>
      <option value="2">Listbox Option 2</option>
      <option value="3">Listbox Option 3</option>
      <option value="4">Listbox Option 4</option>
      </select>
      <input type="button" value="Source" onclick="Source7">
      <HR>
     
      <!--==--==--==--==--==--==--==-- Multi-Select ListBox --==--==--==--==--==--==-->
      <FONT SIZE=2><B><I>Use Ctrl to Select Multiple Options:</I></B></FONT><BR>
      <select size="4" name="MultiListBox" multiple>
      <option value="1">MultiListBox Option 1</option>
      <option value="2">MultiListBox Option 2</option>
      <option value="3">MultiListBox Option 3</option>
      <option value="4">MultiListBox Option 4</option>
      </select>
      <BR>
      <BR>
      <CENTER>
      <input type="button" onClick="RunMultiList" value="Submit">
      <input type="button" value="Source" onclick="Source8">
      </CENTER>
     
      <!--==--==--==--==--==--==--==-- ListBox From File --==--==--==--==--==--==-->
      <HR>
      <FONT SIZE=2><B><I>Drop Down Menu From File</I></B></FONT><BR>
      <select size="1" name="AvailablePhrases">
      <option>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp</option>
      </select>
      <BR>
      <BR>
      <CENTER>
      <input type="button" onClick="onthefly" value="Submit">
      <input type="button" value="Open" onclick="OpenPhrases">
      <input type="button" value="Source" onclick="Source9">
      </CENTER>
     
      <!--==--==--==--==--==--==--==-- Browse For File --==--==--==--==--==--==-->
      <HR>
      <FONT SIZE=2><B><I>Please specify a text file To Open:</I></B></FONT><BR>
      <input type="file" style="background-color:#ffb7d6" name="datafile" size="25">
      <p>
      <CENTER>
      <input type="submit" onClick="Readfile" value="Open File">
      <input type="button" value="Source" onclick="Source10">
      </CENTER>
      </p>
     
      </TD>
      </TR>
      </TABLE>
     
      <!--==--==--==--==--==--==--==-- Quit --==--==--==--==--==--==-->
      <CENTER>
      <HR Size -1>
      <INPUT STYLE="filter:progid:DXImageTransform.Microsoft.Gradient (GradientType=0, StartColorStr='#c70000', EndColorStr='#ffdfdf')" TYPE=BUTTON NAME="Quit" VALUE=" Quit ">
      </CENTER>
     
      </CENTER>
      </BODY>
      </HTML>

  3. #3
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2011
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Novembre 2011
    Messages : 163
    Points : 304
    Points
    304
    Par défaut
    Merci beaucoup Hackoofr !

    C'est vrai que cet outil est trés intéressant.
    Ca ne répond pas tout à fait à ce que je voulais faire (éviter les pop-up et minimiser le nombre de clics souris).

    Néanmoins, cela m'apporte une vrai solution, en ajoutant simplement un bouton "Aide" :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    <head>
    <title>OUTILS</title>
    <HTA:APPLICATION
    APPLICATION="OUTILS"
    ICON="outils.ico"
    BORDER="thin"
    SCROLL="no"
    SINGLEINSTANCE="no"
    WINDOWSTATE="normal">
    </head>
    <script language="VBScript">
     
    Sub Window_onLoad
    Me.ResizeTo 400,260
    Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 130)
    End Sub
     
    Sub RunDropClick
    Select Case Operation.Value
    	Case "sauvegarde"
    	MsgBox "Explication de la sauvegarde", 64, "Aide"
    	Case "restauration"
    	MsgBox "Explication de la restauration", 64, "Aide"
    	Case "réinitialisation"
    	MsgBox "Explication de la réinitialisation", 64, "Aide"
    	Case "vérification"
    	MsgBox "Explication de la vérification", 64, "Aide"
    End Select
    End Sub
     
    Sub Operate_OnClick
    MsgBox "Lancement du programme de " & Operation.Value, 64, Operation.Value
    End Sub
     
    </script>
     
    <body STYLE="font:12 pt calibri; color:white;filter:progid:DXImageTransform.Microsoft.Gradient
    (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">
     
    <p align="center">OUTILS</p>
     
    <p align="center">Que voulez-vous faire ?<br></br>
    <SELECT NAME="Operation" SIZE=1>
    <OPTION VALUE="sauvegarde">Sauvegarder votre configuration</option>
    <OPTION VALUE="restauration">Restaurer une configuration</option>
    <OPTION VALUE="réinitialisation">Réinitialiser la configuration</option>
    <OPTION VALUE="vérification">Vérifier la configuration</option>
     
    </SELECT></p>
    <p align="center"><input type="button" onClick="RunDropClick" value="     Aide     ">
      <input type="button" value=" Démarrer " name="Operate">
    </p>
    </body>
    Je laisse un tout petit peu le sujet ouvert au cas où un génie du HTA ait la réponse à la question initiale.
    Sinon, la solution des pop-up d'information est tout à fait acceptable.
    Merci encore Hackoofr !
    ++

  4. #4
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Vous voulez comment améliorer votre HTA ?
    Si vous voulez minimsez un peu les clicks, vous avez l'évenement OnChange
    Les fonctions de la sauvegarde, de la restauration, de la réinitialisation et de la vérification sont prêtes ou non ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <SELECT NAME="Operation" SIZE=1 onChange="RunDropClick()">
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    <head>
    <title>OUTILS</title>
    <HTA:APPLICATION
    APPLICATION="OUTILS"
    ICON="outils.ico"
    BORDER="thin"
    SCROLL="no"
    SINGLEINSTANCE="no"
    maximizebutton="no"
    WINDOWSTATE="normal">
    <style>
    body {
    color:black;
    background-image:url(http://www.usinenouvelle.com/expo/img/makita-boite-a-outils-000327008-4.jpg);
    background-repeat:no-repeat;
    background-position:center center;
    }
    </style>
    </head>
    <script language="VBScript">
     
    Sub Window_onLoad
    Me.ResizeTo 400,260
    Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 130)
    End Sub
     
    Sub RunDropClick
    Select Case Operation.Value
        Case "sauvegarde"
        MsgBox "Explication de la sauvegarde", 64, "Aide"
        Case "restauration"
        MsgBox "Explication de la restauration", 64, "Aide"
        Case "réinitialisation"
        MsgBox "Explication de la réinitialisation", 64, "Aide"
        Case "vérification"
        MsgBox "Explication de la vérification", 64, "Aide"
    End Select
    End Sub
     
    Sub Operate_OnClick
    MsgBox "Lancement du programme de " & Operation.Value, 64, Operation.Value
    End Sub
    </script>
    <body STYLE="font:12 pt calibri; color:Orange;filter:progid:DXImageTransform.Microsoft.Gradient
    (GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">
    <p align="center">OUTILS</p>
    <p align="center">Que voulez-vous faire ?<br></br>
    <SELECT NAME="Operation" SIZE=1 onChange="RunDropClick()">
    <OPTION VALUE="sauvegarde">Sauvegarder votre configuration</option>
    <OPTION VALUE="restauration">Restaurer une configuration</option>
    <OPTION VALUE="réinitialisation">Réinitialiser la configuration</option>
    <OPTION VALUE="vérification">Vérifier la configuration</option>
     
    </SELECT></p>
    <p align="center"><input type="button" onClick="RunDropClick" value="     Aide     ">
      <input type="button" value=" Démarrer " name="Operate">
    </p>
    </body>

  5. #5
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2011
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Novembre 2011
    Messages : 163
    Points : 304
    Points
    304
    Par défaut
    Bonjour Hackoofr !

    Oui, j'avais pensé au OnChange, mais c'est encore pire, il y a un pop-up à chaque changement de sélection.
    Et il faut cliquer sur ok à chaque fois ... L'idée reste que l'information soit disponible mais qu'elle ne s'impose pas aux utilisateurs.

    Pour ta deuxième question, oui j'ai actuellement 4 fichiers VBS et 1 fichier Lisez-moi.doc expliquant le fonctionnement des 4 outils.
    Je cherche à tout réunir en seul outil HTA.

    Mais je comprends que ma question est peut-être sans solution puisque ce que j'aimerais modifier est pris en compte au moment du OnLoad ...

    Merci en tous cas de te soucier de ma requête.
    Bonne journée !

  6. #6
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut
    Citation Envoyé par Cachlab Voir le message
    Pour ta deuxième question, oui j'ai actuellement 4 fichiers VBS et 1 fichier Lisez-moi.doc expliquant le fonctionnement des 4 outils.
    Je cherche à tout réunir en seul outil HTA.
    Mais je comprends que ma question est peut-être sans solution puisque ce que j'aimerais modifier est pris en compte au moment du OnLoad ...

    Essayez de mettre chaque fichier dans une procédure ou bien dans une fonction et vous les appeler dans le HTA
    vous pouvez aussi partager vos codes pour voir si c'est possible de l'intégrer dans le HTA

  7. #7
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2011
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Novembre 2011
    Messages : 163
    Points : 304
    Points
    304
    Par défaut
    Merci pour tes conseils. A vrai dire l'intégration du code ne me pose aucun problème.
    C'est sur la partie déco - design - ergo que j'ai des difficultés !
    D'où cette tentative HTA ...

    Pour le reste du code, il est trés spécifique à mon entreprise et à un outil interne.
    Aucun intérêt donc pour les visiteurs de ce forum.

    Je vais me contenter de la solution OnClic pour l'instant.
    Encore merci pour ton aide.
    Bonne journée !

  8. #8
    Expert éminent
    Avatar de hackoofr
    Homme Profil pro
    Enseignant
    Inscrit en
    Juin 2009
    Messages
    3 839
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Juin 2009
    Messages : 3 839
    Points : 9 222
    Points
    9 222
    Par défaut

    Vous pouvez aussi utiliser la méthode InnerHTML pour afficher les infos ou bien le help au lieu du MsgBox
    Vous pouvez voir cet exemple : ComputerInfoTool.hta
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    <html>
    <head>
    <title>Computer Info Tool (http://www.wisesoft.co.uk)</title>
    <hta:application 
    applicationname="WiseSoft Computer Info Tool"
     scroll="yes" 
     singleinstance="no"
     icon="Magnify.exe"
     windowstate="normal">
    <style type="text/css">
    body {
        margin:0px;
        background-color:#CBCBCB; /*#F6F6F6;*/
        font-family:Arial, Helvetica, sans-serif;
        font-size:14px;
        color:#595959;
    }
    h1 {
        font-size:24px;
        font-weight:bold;
        color:#FFFFFF;
        background-color:#2886C8;
        text-align:center;
        border-style:solid;
        border-width:thin;
        border-color:#C9E0F1;
        padding:5px;
    }
    h2 {
        font-size:18px;
        font-weight:bold;
    }
    h3 {
        font-size:16px;
        font-weight:bold;
    }
    a {
        color:#2886C8;
    }
     
    #Main {
        margin-left:20px;
        margin-right:20px;
    }
    #DisplayError {
        color:red;
        margin-left:20px;
        margin-right:20px;
    }
    #Footer {
        margin:20px;
        font-weight:bold;
        font-size:16px;
    }
    #Header {
        margin-left:20px;
        margin-right:20px;
        text-align:center;
    }
    #Tools {
        text-align:center;
        border-color:#595959;
        border-style:dotted;
        border-width:1px;
        background-color:#F6F6F6;
        margin-left:20px;
        margin-right:20px;
        margin-top:20px;
        padding:5px;
    }
    .Button { 
        color: #444444; 
    } 
    .InfoSectionHeader {
        font-size:20px;
        font-weight:bold;
        background-color:#595959;
        color:#FFFFFF;
        text-align:center;
        padding:5px;
        margin-top:0px;
        cursor:pointer;
    }
    .InfoSection {
        text-align:center;
        margin-bottom:10px;
        background-color:#FFFFFF;
        border-color:#595959;
        border-style:dotted;
        border-width:1px;
    }
    .InfoSectionBody {
        padding:10px;
    }
    .Link {
        text-decoration: underline;
        cursor:pointer;
        color:#2886C8;
    }
    .HeaderLink {
        text-decoration: underline;
        cursor:pointer;
        color:#FFFFFF;
    }
    .Table {
        /*width:90%;*/
        border: 2px solid;
        border-collapse: collapse;
        border-color: #696969;
    }
    .Table th {
        border: 1px dotted #111111;
        border-color: #787878;
        color: #FFFFFF;
        font: bold 12pt arial, sans-serif;
        background-color: #595959; /* #787878;*/
        text-align: left;
     padding=3px;
    }
    .Table td {
        border: 1px dotted #111111;
        border-color: #787878;
        font: bold 10pt arial, sans-serif;
        color: #787878;
     padding=5px;
    }
     
    </style>
    <script language="VBScript">
        Option Explicit
        Const bytesToMB = 1048576
        Const bytesToGB = 1073741824
        Const bytesToTB = 1099511627776
        Const adVarChar = 200
        Const adDate = 7
        Const MaxCharacters = 255
        Const adFldIsNullable = 32
        Const adInteger = 3
        Const adBigInt = 20
        Const blnConfirmKillProcess = true
        Const ADS_SECURE_AUTHENTICATION = 1
     
        Private objWMIService
        Private strComputer
        private intProcessTimerID
     
        ' ***************************************
        ' Open Windows explorer to a given path
        ' Used when clicking a link in the "Shares" section
        ' ***************************************
        Sub OpenUNC(ByVal strPath)
     
            Dim objShell
     
            Set objShell = CreateObject("Wscript.Shell")
            strPath = "explorer.exe /e," & strPath
            objShell.Run strPath
     
        End Sub
     
        ' ***************************************
        ' Reboot computer
        ' ***************************************
        Sub RebootComputer()
            Dim objItem, colItems
            strComputer = CurrentComputer.InnerHTML
            if MsgBox("Are you sure you want to reboot '" & strComputer & "'?",vbYesNo+vbExclamation,"Confirm Reboot") = vbYes then
                Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
                For Each objItem in colItems
                    objItem.Reboot()
                Next
                msgbox "Computer '" & strComputer & "' has been rebooted",vbOKOnly+vbInformation
            end if
     
        End Sub
     
        ' ***************************************
        ' Shutdown computer
        ' ***************************************
        Sub ShutDownComputer()
            Dim objItem, colItems
            strComputer = CurrentComputer.InnerHTML
     
            dim intOption
            intOption = InputBox("Shutdown computer '" & strComputer & "'" & vbcrlf & _
                    "Options:" & vbcrlf & vbcrlf & _
                    "0 = Log Off " & vbcrlf & _
                    "4 = Forced Log Off" & vbcrlf & _
                    "1 = Shut Down" & vbcrlf & _
                    "5 = Forced Shutdown" & vbcrlf & _
                    "2 = Reboot" & vbcrlf & _
                    "6 = Forced Reboot" & vbcrlf & _
                    "8 = Power Off" & vbcrlf & _
                    "12 = Forced Power Off","Shutdown",1)
            SELECT CASE intOption
                CASE "0","4","1","5","2","6","8","12"
                        Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
                        For Each objItem in colItems
                            objItem.Win32Shutdown(intOption)
                        Next
                        msgbox "Command has been sent to '" & strComputer & "'",vbOKOnly+vbInformation
                CASE ""
                CASE Else
                        msgbox "Invalid option specified:" & intOption,vbOKOnly+vbExclamation
            END SELECT
     
        End Sub
     
        ' ***************************************
        ' Kills the specified process
        ' Called when "Kill Process" link is clicked in the Running Processes section
        ' ***************************************
        Sub KillProcess(ByVal intProcessID, ByVal strName)
            Dim objItem, colItems
            strComputer = CurrentComputer.InnerHTML
            if blnConfirmKillProcess = True then
                if msgbox("Are you sure you want to kill the '" & strName & "' process on '" & strComputer & "'?",vbYesNo+vbExclamation,"Confirm Kill Process") = vbNo then
                    exit sub
                end if
            end if
            'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
            Set colItems = objWMIService.ExecQuery("Select * from Win32_Process WHERE ProcessID = '" & _
                                                 intProcessID & "' AND Name = '" & strName & "'")
     
            For Each objItem In colItems
                objItem.Terminate()
            Next
            RefreshProcesses
        End Sub
     
        ' ***************************************
        ' Refreshes list of processes in the "Running Processes" section
        ' ***************************************
        Sub RefreshProcesses
            'strComputer = CurrentComputer.InnerHTML
            'Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
            ProcessesData.InnerHTML = RunningProcesses_HTML
        End Sub
     
        ' ***************************************
        ' Enables/Disables the auto refresh feature in the "Running Processes" section
        ' ***************************************
        sub SetProcessAutoRefresh
            dim intInterval
            ' Get the refresh interval
            intInterval = ProcessAutoRefresh.Value
            ' Remove the current auto-refresh
            window.clearInterval(intProcessTimerID)
            ' Add an auto-refresh if specified
            if intInterval > 0 then
                intProcessTimerID = window.setInterval("RefreshProcesses", intInterval)
            end if
        end sub
     
        ' ***************************************
        ' Stores the sort value for "Running Processes" section in a hidden div
        ' and refreshes the processes list with the new sort value
        ' ***************************************
        Sub SortProcesses(byval strSort)
            ' If sort link is clicked twice on the same column, sort descending
            if ProcessSort.InnerHTML = strSort then
                ProcessSort.InnerHTML = strSort & " DESC"
            else
                ProcessSort.InnerHTML = strSort
            end if
            RefreshProcesses()
        End Sub
     
        ' ***************************************
        ' Map as network drive on this computer to a share on another computer
        ' Called from the "Shares" section. User is prompted for a drive letter
        ' ***************************************
        Sub MapDrive(ByVal strPath)
            Dim objNetwork
            Dim strDrive
            strDrive = InputBox("Enter drive letter:","Drive Letter","Z")
            If strDrive <> "" Then
                strDrive = Left(strDrive,1) & ":"
     
                Set objNetwork = CreateObject("WScript.Network")
                objNetwork.MapNetworkDrive strDrive,strPath
            End If
        End Sub
     
        ' ***************************************
        ' Stores the sort value for "Running Processes" section in a hidden div
        ' ***************************************
        Sub MapPrinter(ByVal strPath)
            Dim objNetwork
            Set objNetwork = createobject("Wscript.Network")
            objNetwork.AddWindowsPrinterConnection(strPath)
            If MsgBox("Make Printer Default?",vbYesNo+vbQuestion,"Default Printer") = vbYes Then
                objNetwork.SetDefaultPrinter strPath
            End If
        End Sub
     
        ' ***************************************
        ' Replace special HTML characters
        ' ***************************************
        Function HTMLEncode(strValue)
            HTMLEncode= REplace(Replace(strValue,"<","&lt;"),">","&gt;")
        End Function
     
        ' ***************************************
        ' Convert Bytes to MB,GB or TB as appropriate
        ' ***************************************
        Function ConvertToDiskUnit(ByVal value) 
            IF (value/bytesToTb) > 1 Then
                ConvertToDiskUnit = round(value / bytesToTB,1) & " TB"
            ELSEIF (value/bytesToGb) > 1 Then
                ConvertToDiskUnit = round(value / bytesToGB,1) & " GB"
            Else
                ConvertToDiskUnit = round(value / bytesToMB,1) & " MB"
            END If
        End Function
     
            ' ***************************************
        ' Convert integer value to string
        ' ***************************************
        Function GetMemoryType(ByVal intType)
               Dim strType
            Select case intType
            Case 0
                 strType = "Unknown"
             Case 1
                 strType = "Other"
             Case 2
                 strType = "DRAM"
             Case 3
                 strType = "Synchronous DRAM"
            Case 4
                strType = "Cache DRAM"
            Case 5
                strType = "EDO" 
            Case 6
                 strType = "EDRAM" 
            Case 7
                 strType = "VRAM"
            Case 8
                 strType = "SRAM"
            Case 9
                  strType = "RAM"
            Case 10
                 strType = "ROM"
            Case 11
                strType = " Flash"
            Case 12
                strType = "EEPROM"
            Case 13
                 strType = "FEPROM"
            Case 14
                 strType = " EPROM"
            Case 15
                 strType = " CDRAM"
            Case 16
                  strType = "3DRAM"
            Case 17
                 strType = " SDRAM"
            Case 18
                 strType = " SGRAM"
            Case 19
                 strType = " RDRAM"
            Case 20
                 strType = " DDR"
            Case 21
                 strType = " DDR-2"
            Case Else
                 strType = "Unknown"
            End Select
            GetMemoryType=strType
        End Function
     
        ' ***************************************
        ' Convert Integer value to string
        ' ***************************************
        Function GetMemoryFormFactor(ByVal intFormFactor)
            Dim strFormFactor
            Select Case intFormFactor
            Case 0
                strFormFactor = "Unknown"
            Case 1
                strFormFactor = "Other"
            Case 2
                strFormFactor = "SIP"
            Case 3
                strFormFactor = "DIP"
            Case 4
                strFormFactor = "ZIP"
            Case 5
                strFormFactor = "SOJ"
            Case 6
                strFormFactor = "Proprietary"
            Case 7
                strFormFactor = "SIMM"
            Case 8
                strFormFactor = "DIMM"
            Case 9
                strFormFactor = "TSOP"
            Case 10
                strFormFactor = "PGA"
            Case 11
                strFormFactor = "RIMM"
            Case 12
                strFormFactor = "SODIMM"
            Case 13
                strFormFactor = "SRIMM"
            Case 14
                strFormFactor = "SMD"
            Case 15
                strFormFactor = "SSMP"
            Case 16
                strFormFactor = "QFP"
            Case 17
                strFormFactor = "TQFP"
            Case 18
                strFormFactor = "SOIC"
            Case 19
                strFormFactor = "LCC"
            Case 20
                strFormFactor = "PLCC"
            Case 21
                strFormFactor = "BGA"
            Case 22
                strFormFactor = "FPBGA"
            Case 23
                strFormFactor = "LGA"
            case Else
                strFormFactor = "Unknown"
            End Select
            GetMemoryFormFactor=strFormFactor
        End Function
     
           ' ***************************************
        ' Convert date string to a more readable format
        ' ***************************************
        Function FormatDate(ByVal strValue)
            Dim strDate
            If ISNULL(strValue) Or strValue = "" Then
                strDate = ""
            Else
                strDate = Left(strValue,4) & "-" & MID(strValue,5,2) & "-" & MID(strValue,7,2) & " " & _
                        Mid(strValue,9,2) & ":" &  Mid(strValue,11,2)
            End If
            FormatDate = strDate
        End Function
     
        ' ***************************************
        ' Clear existing report data
        ' ***************************************
        Sub Reset
            ProcessAutoRefresh.Value="0"
            window.clearInterval(intProcessTimerID)
            Main.Style.Display = "none"
            Tools.Style.Display = "none"
            LogicalDisk.InnerHTML=""
            PhysicalDisk.InnerHTML=""
            Processor.InnerHTML =""
            Memory.InnerHTML = ""
            OS.InnerHTML =""
            Shares.InnerHTML=""
            DisplayError.InnerHTML=""
        End Sub
     
        ' ***************************************
        ' Main procedure used to generate report
        ' Calls other procedures that generate the HTML for each section
        ' ***************************************
        Sub GenerateReport
            Reset()
            strComputer = txtComputer.Value
            if strComputer = "" Then 
                Dim objNetwork
                set objNetwork = createobject("wscript.network")
                strComputer =  objNetwork.ComputerName
                txtComputer.Value = strComputer
            End If
            CurrentComputer.InnerHTML = strComputer
            Dim objSWbemLocator
            On Error Resume Next
            If txtUserName.Value <> "" Then
                Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
                Set objWMIService = objSWbemLocator.ConnectServer _
                    (strComputer, "root\cimv2", txtUserName.Value, txtPassword.Value)
                objWMIService.Security_.ImpersonationLevel = 3
            Else
                Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
            End If
     
            If Err.Number <> 0 Then
                On Error GoTo 0
                DisplayError.InnerHTML = "Error connecting to '" & strComputer & "'"
                Err.Clear
                Exit Sub
            End If
            On Error GoTo 0
            Main.Style.Display = ""
            Tools.Style.Display = ""
     
            ProcessesData.InnerHTML = RunningProcesses_HTML
            LogicalDisk.InnerHTML = LogicalDisk_HTML
            PhysicalDisk.InnerHTML = PhysicalDisk_HTML
            Processor.InnerHTML = Processor_HTML
            Memory.InnerHTML = Memory_HTML
            OS.InnerHTML = OS_HTML
            Shares.InnerHTML = Shares_HTML
            Users.InnerHTML = Users_HTML
     
        End Sub
     
     
        ' ***************************************
        ' Gets a list of running processes and returns HTML for the "Running Processes" section
        ' ***************************************
        Function RunningProcesses_HTML
            Dim row,strHTML,strFilter
            Dim DataList,colItems,objItem,strUser,strDomain
            Dim strWMIQuery
            strFilter = txtProcessFilter.Value
     
            ' Recordset is used to sort data from WMI
            Set DataList = CreateObject("ADOR.Recordset")
            DataList.Fields.Append "Name", adVarChar, MaxCharacters, adFldIsNullable
            DataList.Fields.Append "WorkingSet", adInteger, adFldIsNullable
            DataList.Fields.Append "CreationDate",adVarChar, MaxCharacters, adFldIsNullable
            DataList.Fields.Append "Description",adVarChar,MaxCharacters, adFldIsNullable
            DataList.Fields.Append "ProcessID",adInteger, adFldIsNullable
            DataList.Fields.Append "CPUTime",adInteger, adFldIsNullable
            DataList.Fields.Append "Caption",adVarChar,MaxCharacters, adFldIsNullable
            DataList.Fields.Append "Owner",adVarChar,MaxCharacters, adFldIsNullable
            DataList.Fields.Append "Path",adVarChar,MaxCharacters, adFldIsNullable
            DataList.Open
     
            strWMIQuery = "Select * From Win32_Process"
            ' Add filter if required
            if strFilter <> "" then
                strWMIQuery = strWMIQuery & " WHERE Name LIKE '%" & strFilter & "%'"
            end if
     
            Set colItems = objWMIService.ExecQuery(strWMIQuery)
     
            ' Load WMI data into recordset
            For Each objItem in colItems
                Dim strOwner
                DataList.AddNew
                on error resume next
                DataList("Name") = HTMLEncode(objItem.Name)
                DataList("WorkingSet") = objItem.WorkingSetSize
                DataList("CreationDate") = objItem.CreationDate
                DataList("Description") = HTMLEncode(objItem.Description)
                DataList("ProcessID") = objItem.ProcessID
                DataList("Caption") = objItem.Caption
                DataList("CPUTime") = (CSng(objItem.KernelModeTime) + CSng(objItem.UserModeTime)) / 10000000
                If objItem.GetOwner (strUser, strDomain) = 0 Then
                    strOwner = strDomain & "\" & strUser
                End If
                DataList("Owner") = strOwner
                on error goto 0
                DataList.Update
            Next
            ' Sort recordset
            DataList.Sort = ProcessSort.InnerHTML
            ' Check if recordset is not empty
            If DataList.BOF = FALSE then
                DataList.MoveFirst
                ' Generate HTML table report with running processes
                strHTML = strHTML & "<table class=""Table"">"
                strHTML = strHTML &  "<tr><th><span onclick=""SortProcesses('Name')"" class=""HeaderLink"">Name</span></th>" & _
                            "<th><span onclick=""SortProcesses('CreationDate')"" class=""HeaderLink"">Creation Date</span></th>" & _
                            "<th><span onclick=""SortProcesses('Owner')"" class=""HeaderLink"">Owner</span></th>" & _
                            "<th><span onclick=""SortProcesses('WorkingSet')"" class=""HeaderLink"">Working Set</span></th>" & _
                            "<th><span onclick=""SortProcesses('CPUTime')"" class=""HeaderLink"">Total CPU Time(s)</span></th>" & _
                            "<th>&nbsp;</th></tr>"
     
                Do Until DataList.EOF
                    Dim strCaption,strCreationDate,strPath,intProcessID,strDescription
                    Dim strWorkingSet
     
                    strHTML = strHTML & "<tr>" & _
                                        "<td><div title=""" & DataList("Path") & """>" & DataList("Name") & "</div></td>" & _
                                        "<td>" & FormatDate(DataList("CreationDate")) & "</td>" & _
                                        "<td>" & DataList("Owner") & "</td>" & _
                                        "<td>" & ConvertToDiskUnit(DataList("WorkingSet")) & "</td>" & _
                                        "<td>" & DataList("CPUTime")  & "</td>" & _
                                        "<td><span onclick=""KillProcess '" & DataList("ProcessID") & "','" & DataList("Name") & "'"" class=""Link"">Kill Process</span></td>" & _
                                        "</tr>"
                    DataList.MoveNext
                Loop
                strHTML = strHTML & "</table>"
            end if
            DataList.Close
            strHTML = strHTML & "<br>Last Refresh:" & Now()
     
            RunningProcesses_HTML=strHTML
        End Function
     
        ' ***************************************
        ' Gets a list of shared folders and shared printers and
        ' returns HTML for the "Shares" section
        ' *************************************** 
        Function Shares_HTML
            Dim objItem, colItems
            Dim strHTML
     
            ' Query to return shared folders
            Set colItems = objWMIService.ExecQuery("Select * from Win32_Share WHERE Type = 2147483648 OR Type = 0")
     
            strHTML = strHTML & "<table><tr><td style=""vertical-align:top"">"
            strHTML = strHTML & "<table class=""Table""><tr><th colspan=""2"">Folder Shares</th></tr>"
            For Each objItem In colItems
                Dim strShare 
                strShare = HTMLEncode(objItem.Name)
                strHTML = strHTML & "<tr><td><span class=""Link"" onclick=""OpenUNC('\\" & strComputer & "\" & strShare & "')"">" & strShare & "</span></td>"
                strHTML = strHTML &    "<td><input class=""Button"" type=""button"" onclick=""MapDrive('\\" & strComputer & "\" & strShare & "')"" value=""Map Drive""></input></td></tr>"
            Next
            strHTML = strHTML & "</table></td>"
     
            ' Query to return shared printers
            Set colItems = objWMIService.ExecQuery("Select * from Win32_Share WHERE Type = 2147483649 OR Type = 1")
     
            strHTML = strHTML & "<td style=""vertical-align:top"">"
            strHTML = strHTML & "<table class=""Table""><tr><th colspan=""2"">Printer Shares</th></tr>"
            For Each objItem In colItems
                Dim strPrinterShare 
                strPrinterShare = HTMLEncode(objItem.Name)
                strHTML = strHTML & "<tr><td><span class=""Link"" onclick=""OpenUNC('\\" & strComputer & "\" & strPrinterShare & "')"">" & strPrinterShare & "</span></td>"
                strHTML = strHTML &    "<td><input class=""Button"" type=""button"" onclick=""MapPrinter('\\" & strComputer & "\" & strPrinterShare & "')"" value=""Connect Printer""></input></td></tr>"
            Next
            strHTML = strHTML & "</table></td></table>"
     
            Shares_HTML = strHTML 
        End Function
     
        ' ***************************************
        ' Gets computer system info to be included in the "OS / General" section
        ' *************************************** 
        Sub GetComputerSystemInfo(BYRef strDNSHostName,ByRef strDomain,ByRef strDomainRole, _
                                ByRef strManufacturer,ByRef strModel,ByRef strUserName)
            Dim objItem, colItems
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
            For Each objItem In colItems
                On Error Resume Next 
                strDNSHostName = HTMLEncode(objItem.DNSHostName)
                strDomain = HTMLEncode(objItem.Domain)
                strManufacturer = HTMLEncode(objItem.Manufacturer)
                strModel = HTMLEncode(objItem.Model)
                strUserName = HTMLEncode(objItem.UserName)
                On Error GoTo 0
                If strUserName = "" Then
                    strUserName = "{not logged in}"
                End If
                Select Case objItem.DomainRole
                    Case 0
                    strDomainRole="Standalone Workstation"
                    Case 1
                    strDomainRole="Member Workstation"
                    Case 2
                    strDomainRole="Standalone Server"
                    Case 3
                    strDomainRole="Member Server"
                    Case 4
                    strDomainRole="Backup Domain Controller"
                    Case 5
                    strDomainRole="Primary Domain Controller"
                    Case Else
                    strDomainRole = "Unknown (" & strDomainRole & ")"
                End Select
            Next
        End Sub
     
        ' ***************************************
        ' Returns a HTML report for the "Operating System/General" section
        ' ***************************************  
        Function OS_HTML()
     
            Dim objItem, colItems
            Dim strHTML
            Dim strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
            GetComputerSystemInfo strDNSHostName,strDomain,strDomainRole,strManufacturer,strModel,strUserName
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
     
            strHTML = "<h3>Current User: " & strUserName & "</h3>"
     
            For Each objItem In colItems
                Dim strComputerRole
                Dim strCaption,strBuildNumber,strInstallDate,strBootDate
                Dim intServicePackMajor,intServicePackMinor,intTotalVisibleMemorySize
                Dim intFreePhysicalMemory,intTotalVirtualMemorySize,intFreeVirtualMemory
                On Error Resume Next
                strCaption = HTMLEncode(objItem.Caption)
                strBuildNumber = HTMLEncode(objItem.BuildNumber)
                intServicePackMajor = objItem.ServicePackMajorVersion
                intServicePackMinor = objItem.ServicePackMinorVersion
                intTotalVisibleMemorySize = objItem.TotalVisibleMemorySize
                intFreePhysicalMemory = objItem.FreePhysicalMemory
                intFreeVirtualMemory =  objItem.FreeVirtualMemory
                intTotalVirtualMemorySize = objItem.TotalVirtualMemorySize
                strInstallDate = FormatDate(objItem.InstallDate)
                strBootDate = FormatDate(objItem.LastBootUpTime)
                On Error GoTo 0
     
                strHTML = strHTML & "<table class=""Table"">" & _
                             "<tr>" & _
                             "<th>Operating System:</th><td>" & strCaption & "</td>" & _
                             "<th>Build Number:</th><td>" & strBuildNumber & "</td>" & _
                             "</tr><tr>" & _
                             "<th>Service Pack:</th><td>" & intServicePackMajor & "." &  intServicePackMinor & "</td>" & _
                             "<th>Role:</th><td>" & strDomainRole & "</td>" & _
                             "</tr><tr>" & _
                             "<th>DNS Host Name:</th><td>" & strDNSHostName & "</td>" & _
                             "<th>Domain:</th><td>" & strDomain & "</td>" & _
                             "</tr><tr>" & _
                             "<th>Manufacturer:</th><td>" & strManufacturer & "</td>" & _
                             "<th>Model:</th><td>" & strModel & "</td>" & _
                             "</tr><tr>" & _
                             "<th>Total Physical Memory:</th><td>" & intTotalVisibleMemorySize & "KB</td>" & _
                             "<th>Free Physical Memory:</th><td>" & intFreePhysicalMemory  & "KB</td>" & _
                             "</tr><tr>" & _
                             "<th>Total Virtual Memory:</th><td>" & intTotalVirtualMemorySize & "KB</td>" & _
                             "<th>Free Virtual Memory:</th><td>" & intFreeVirtualMemory & "KB</td>" & _
                             "</tr><tr>" & _
                             "<th>Install Date:</th><td>" & strInstallDate & "</td>" & _
                             "<th>Last BootUp Time:</th><td>" & strBootDate & "</td>" & _
                             "</tr>" & _
                             "</table>"
     
                Exit For
            Next
     
            OS_HTML = strHTML
     
        End Function
     
        ' ***************************************
        ' Get the number of memory slots and memory arrays
        ' for the memory section
        ' ***************************************
        Function GetMemoryArrayInfo(ByRef intSlots,ByRef intArrays)
            Dim objItem, colItems
            intSlots = 0
            intArrays = 0
            Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemoryArray WHERE Use=3")
     
            For Each objItem In colItems
                intSlots = intSlots + objItem.MemoryDevices
                intArrays = intArrays + 1
            Next
        End Function
     
        ' ***************************************
        ' Returns a HTML report for the "Memory" section
        ' ***************************************  
        Function Memory_HTML()
            Dim objItem, colItems
            Dim strHTML
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_PhysicalMemory")
     
            strHTML = "<table class=""Table"">" & _
                    "<tr>" & _
                    "<th>BankLabel</th>" & _
                    "<th>Capacity</th>" & _
                    "<th>Caption</th>" & _
                    "<th>Description</th>" & _
                    "<th>DeviceLocator </th>" & _
                    "<th>Manufacturer</th>" & _
                    "<th>Memory Type</th>" & _
                    "<th>Form Factor</th>" & _
                    "<th>Model</th>" & _
                    "<th>Speed</th>" & _
                    "</tr>"
     
            For Each objItem In colItems
                Dim strBankLabel,strCaption,strDescription,strDeviceLocator
                Dim strManufacturer,strMemoryType,strFormFactor,strModel
                Dim strCapacity,intSpeed
                On Error Resume Next
                strBankLabel = HTMLEncode(objItem.BankLabel) 
                strCapacity = ConvertToDiskUnit(objItem.Capacity)
                strCaption = HTMLEncode(objItem.Caption)
                strDescription = HTMLEncode(objItem.Description)
                strDeviceLocator = HTMLEncode(objItem.DeviceLocator)
                strManufacturer = HTMLEncode(objItem.Manufacturer)
                strMemoryType = GetMemoryType(objItem.MemoryType)
                strFormFactor = GetMemoryFormFactor(objItem.FormFactor)
                strModel = HTMLEncode(objItem.Model)
                intSpeed = objItem.Speed
                On Error GoTo 0
     
                strHTML = strHTML & "<tr><td>" & strBankLabel & "</td>" & _
                                    "<td>" & strCapacity & "</td>" & _
                                    "<td>" & strCaption & "</td>" & _
                                    "<td>" & strDescription & "</td>" & _
                                    "<td>" & strDeviceLocator & "</td>" & _
                                    "<td>" & strManufacturer & "</td>" & _
                                    "<td>" & strMemoryType & "</td>" & _
                                    "<td>" & strFormFactor & "</td>" & _
                                    "<td>" & strModel & "</td>" & _
                                    "<td>" & intSpeed & "</td>" & _
                                    "</tr>"
            Next
            strHTML = strHTML & "</table>"
     
            Dim intSlots,intArrays
            GetMemoryArrayInfo intSlots,intArrays
     
            strHTML = strHTML & "Total Memory Slots:" & intSlots & ", Memory Arrays:" & intArrays
     
            Memory_HTML=strHTML
        End Function
     
         ' ***************************************
        ' Returns a HTML report for the "Processor" section
        ' ***************************************  
        Function Processor_HTML()
            Dim objItem, colItems
            Dim strHTML
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
     
            strHTML = "<table class=""Table"">" & _
                    "<tr>" & _
                    "<th>Name</th>" & _
                    "<th>Manufacturer</th>" & _
                    "<th>Description</th>" & _
                    "<th>Address Width</th>" & _
                    "<th>Current Clock Speed</th>" & _
                    "<th>Data Width</th>" & _
                    "<th>Device ID</th>" & _
                    "<th>Ext Clock</th>" & _
                    "<th>L2 Cache</th>" & _
                    "<th>Max Clock Speed</th>" & _
                    "<th>#Cores</th>" & _
                    "<th>#Logical Processors</th>" & _
                    "</tr>"
     
            For Each objItem in colItems
                Dim strName,strManufacturer,strDescription,strDeviceID
                Dim intAddressWidth,intCurrentClockSpeed,intDataWidth,intExtClock
                Dim intL2CacheSize,intMaxClockSpeed, intNumberOfCores,intNumberOfLogicalProcessors
                On Error Resume Next
                strName = HTMLEncode(objItem.Name)
                strManufacturer = HTMLEncode(objItem.Manufacturer)
                strDescription = HTMLEncode(objItem.Description)
                intAddressWidth = objItem.AddressWidth
                intCurrentClockSpeed = objItem.CurrentClockSpeed
                intDataWidth = objItem.DataWidth
                strDeviceID = HTMLEncode(objItem.DeviceID)
                intExtClock = objItem.ExtClock
                intL2CacheSize = objItem.L2CacheSize
                intMaxClockSpeed = objItem.MaxClockSpeed
                intNumberOfCores  = objItem.NumberOfCores
                intNumberOfLogicalProcessors= objItem.NumberOfLogicalProcessors
                On Error GoTo 0
                strHTML = strHTML & "<tr><td>" & strName & "</td>" & _
                                    "<td>" & strManufacturer & "</td>" & _
                                    "<td>" & strDescription & "</td>" & _
                                    "<td>" & intAddressWidth & "</td>" & _
                                    "<td>" & intCurrentClockSpeed & "</td>" & _
                                    "<td>" & intDataWidth & "</td>" & _
                                    "<td>" & strDeviceID  & "</td>" & _
                                    "<td>" & intExtClock & "</td>" & _
                                    "<td>" & intL2CacheSize & "</td>" & _
                                    "<td>" & intMaxClockSpeed & "</td>" & _
                                    "<td>" & intNumberOfCores & "</td>" & _
                                    "<td>" & intNumberOfLogicalProcessors & "</td>" & _
                                    "</tr>"
            Next
            strHTML = strHTML & "</table>"
     
            Processor_HTML=strHTML
        End Function
     
        ' ***************************************
        ' Returns a HTML report for the "Physical Disk" section
        ' ***************************************  
        Function PhysicalDisk_HTML()
            Dim objItem, colItems
            Dim strHTML
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_DiskDrive")
     
            strHTML = "<table class=""Table""><tr><th>Caption</th><th>Manufacturer</th>" & _
                    "<th>Model</th><th>Size</th><th>Serial</th><th>Media Type</th><th>#Partitions</th><th>DeviceID</th><th>Firmware</th><th>Interface</th></tr>"
     
            For Each objItem in colItems
                Dim intSize,intPartitions
                Dim strSize,strCaption,strManufacturer,strModel,strMediaType
                Dim strDeviceID,strFirmwareRevision,strInterfaceType, strSerialNumber
                intSize = objItem.Size
                If IsNumeric(intSize) = False Then
                    intSize = 0
                End If
                On Error Resume Next
                strCaption= HTMLEncode(objItem.Caption) 
                strSize = ConvertToDiskUnit(intSize)
                strSerialNumber = HTMLEncode(objItem.SerialNumber)
                strMediaType = HTMLEncode(objItem.MediaType)
                intPartitions = HTMLEncode(objItem.Partitions)
                strDeviceID = HTMLEncode(objItem.DeviceID)
                strFirmwareRevision = HTMLEncode(objItem.FirmwareRevision)
                strInterfaceType = HTMLEncode(objItem.InterfaceType)
                strModel = HTMLEncode(objItem.Model)
                strManufacturer = HTMLEncode(objItem.Manufacturer)
                On Error GoTo 0
     
                strHTML = strHTML & "<tr><td>" & strCaption & "</td>" & _
                                    "<td>" & strManufacturer & "</td>" & _
                                    "<td>" & strModel & "</td>" & _
                                    "<td>" & strSize & "</td>" & _
                                    "<td>" & strSerialNumber & "</td>" & _
                                    "<td>" & strMediaType & "</td>" & _
                                    "<td>" & intPartitions & "</td>" & _
                                    "<td>" & strDeviceID & "</td>" & _
                                    "<td>" & strFirmwareRevision & "</td>" & _
                                    "<td>" & strInterfaceType & "</td>" & _
                                    "</tr>"
            Next
            strHTML = strHTML & "</table>"
     
            PhysicalDisk_HTML=strHTML
     
        End Function
     
        ' ***************************************
        ' Returns a HTML report for the "Logical Disk" section
        ' ***************************************  
        Function LogicalDisk_HTML()
     
            Dim objItem, colItems
            Dim strDriveType, strDiskSize, strHTML
     
            Set colItems = objWMIService.ExecQuery("Select * from Win32_LogicalDisk WHERE DriveType = 3")
     
            strHTML = "<table class=""Table""><tr><th>Drive</th><th>Name</th><th>File System</th><th>Size</th><th>Used</th><th>Free</th><th>Free(%)</th></tr>"
     
            For Each objItem in colItems
     
                Dim pctFreeSpace,strFreeSpace,strusedSpace,strName,strFileSystem,strVolumeName
                Dim intFreeSpace, intSize
                On Error Resume Next
                intFreeSpace = objItem.FreeSpace
                intSize = objItem.Size
                If ISNUMERIC(intFreeSpace) = False Then
                    intFreeSpace=0
                End If
                If IsNumeric(intSize) = False Then
                    intSize = 0
                End If
                If objItem.FreeSpace > 0 Then
                    pctFreeSpace = round(((intFreeSpace / intSize) * 100),0)
                Else
                    pctFreeSpace=0
                End If
                strDiskSize = ConvertToDiskUnit(intSize) 
                strFreeSpace = ConvertToDiskUnit(intFreeSpace)
                strUsedSpace = ConvertToDiskUnit(intSize-intFreeSpace)
                strName = HTMLEncode(objItem.Name)
                strVolumeName = HTMLEncode(objItem.VolumeName)
                strFileSystem = HTMLEncode(objItem.FileSystem)
                On Error GoTo 0
     
                dim strChart 
                strChart = "<div width=100%;""><span style=""padding:0px;margin:0px;width=" & 100-pctFreeSpace & _
                    "%;background-color:blue;"">&nbsp;</span><span style=""padding:0px;margin:0px;width=" & pctFreeSpace & _
                    "%;background-color:#FF00FF;"">&nbsp;</span></div>"
     
                strHTML = strHTML & "<tr><td>" & strName & "</td><td>" & _
                        strVolumeName & "</td><td>" & strFileSystem & "</td><td>" & _
                        strDiskSize & "</td><td>" & strUsedSpace & "</td><td>" & _
                        strFreeSpace & "</td><td>" &  pctFreeSpace & "%</td></tr>" & _
                        "<tr><td colspan=""7"">" & strChart & "</td></tr>"
     
            Next
     
            strHTML = strHTML + "</table></br>"
     
            LogicalDisk_HTML = strHTML
     
        End Function
     
        ' ***************************************
        ' Returns a HTML report for the "Users" section
        ' ***************************************  
        Function Users_HTML
            Dim strHTML,colItems,objItem, i, strAccountControl
            Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount WHERE LocalAccount=True")
            strHTML = "<table class=""Table""><tr><th>Account Name</th><th>Full Name</th><th>Description</th><th></th><th></th></tr>"
            i = 1
            For Each objItem In colItems
                if objItem.Disabled then
                    strAccountControl = "<span id=""AccountControl" & i & """ class=""Link"" OnClick=""ToggleEnableDisable '" & objItem.Name & "','" & strComputer & "','AccountControl" & i & "'"">Enable</span>"
                else
                    strAccountControl = "<span id=""AccountControl" & i & """ class=""Link"" OnClick=""ToggleEnableDisable '" & objItem.Name & "','" & strComputer & "','AccountControl" & i & "'"">Disable</span>"
                end if
                strHTML = strHTML & "<tr><td>" & objItem.Name & "</td><td>" & objItem.FullName & "</td><td>" & objItem.Description & _
                    "</td><td><input id=""PWD" & i & """ type=""password""></input><span onclick=""ResetPassword '" & objItem.Name & "','" & _
                    strComputer & "','PWD" & i & "'"" class=""Link"">Reset Password</span></td><td>" & strAccountControl & "</td></tr>"
                i = i + 1
            next
            strHTML = strHTML & "</table>"
            Users_HTML = strHTML
        End Function
     
        ' ***************************************
        ' Disables/Enables a user account
        ' ***************************************  
        Sub ToggleEnableDisable(strUserName,strComputerName,strID)
            Dim objUser, objNT
            If txtUserName.Value <> "" then
                Set objNT = GetObject("WinNT:")
                Set objUser = objNT.OpenDSObject("WinNT://" & strComputerName & "/" & strUserName & ", user", txtUserName.Value, txtPassword.Value, ADS_SECURE_AUTHENTICATION)
            Else
                Set objUser = GetObject("WinNT://" & strComputerName & "/" & strUserName & ", user")
            End If
            If objUser.AccountDisabled = True Then
                objUser.AccountDisabled = False
                objUser.SetInfo
                document.getElementById(strID).InnerHTML="Disable"
            Else
                objUser.AccountDisabled = True
                objUser.SetInfo
                document.getElementById(strID).InnerHTML="Enable"
            End If
            set objUser = nothing
            set objNT = nothing
        End Sub
     
        ' ***************************************
        ' Resets a users password
        ' ***************************************  
        Sub ResetPassword(strUserName,strComputerName,strPasswordID)
            Dim strPassword, objUser, objNT
            strPassword = document.getElementById(strPasswordID).Value
            If txtUserName.Value <> "" then
                Set objNT = GetObject("WinNT:")
                Set objUser = objNT.OpenDSObject("WinNT://" & strComputerName & "/" & strUserName & ", user", txtUserName.Value, txtPassword.Value, ADS_SECURE_AUTHENTICATION)
            Else
                Set objUser = GetObject("WinNT://" & strComputerName & "/" & strUserName & ", user")
            End If
            objUser.SetPassword strPassword
            set objUser = nothing 
            set objNT = nothing
            msgbox "Password Changed",vbOKOnly+vbInformation,"Computer Info"
        End Sub
     
        ' ***************************************
        ' Opens Computer Management Console
        ' ***************************************  
        Sub ManageComputer
            dim objSh
            set objSh = createobject("wscript.shell")  
            objSh.run "compmgmt.msc /computer:" & strComputer
            set objSh = nothing
        End Sub
     
        ' ***************************************
        ' Opens a Remote Desktop Connection
        ' ***************************************  
        Sub ConnectRDP
            dim objSh
            set objSh = createobject("wscript.shell")  
            objSh.run "mstsc.exe /v:" & strComputer
            set objSh = nothing
        End Sub
     
    </script>
    <script type="text/javascript">
        /* Toggle expand/collapse state for specified section */
        function toggleDisplay(obj) {
            var el = document.getElementById(obj);
            if ( el.style.display != 'none' ) {
                el.style.display = 'none';
            }
            else {
                el.style.display = '';
            }
        }
        /* Toggle expand/collapse state for all sections */
        function toggleAll() {
            var el = document.getElementById("OS");
            var display = ''
            if ( el.style.display != 'none' ) {
                display = 'none';
            }
            el.style.display = display;
            el = document.getElementById("Memory");
            el.style.display = display;
            el = document.getElementById("LogicalDisk");
            el.style.display = display;
            el = document.getElementById("PhysicalDisk");
            el.style.display = display;
            el = document.getElementById("Processor");
            el.style.display = display;
            el = document.getElementById("Shares");
            el.style.display = display;
            el = document.getElementById("Processes");
            el.style.display = display;
            el = document.getElementById("Users");
            el.style.display = display;
        }
     
    </script>
    </head>
    <body OnLoad="GenerateReport">
    <h1>Computer Info Tool</h1>
    <div id="Header" style="padding-bottom:0px;margin-bottom:0px;">
        <table style="font-weight:bold;"><tr><td>UserName:</td><td><input id="txtUserName"></input></td><td style="font-size:8px;">(Optional)</td><tr>
        <tr><td>Password:</td><td><input type="password" id="txtPassword"></input></td><td style="font-size:8px;">(Optional)</td></tr>
        <tr><td>Computer:</td><td><input id="txtComputer"></input></td>
        <td colspan="2">  <input class="Button" style="font-weight:bold;" onClick="GenerateReport()" type="submit" value="Generate Report">
      </input>
      </td></tr>
      </table>
     </div>
     <div id="Tools" style="display:none;margin-bottom:0px;">
       <span class="Link" onClick="RebootComputer">Reboot Computer</span>&nbsp;|&nbsp;
       <span class="Link" onClick="ShutDownComputer">Shutdown Computer</span>&nbsp;|&nbsp;
       <span class="Link" onClick="ConnectRDP">Remote Desktop</span>&nbsp;|&nbsp;
       <span class="Link" onClick="ManageComputer">Manage</span>
      </div>
     
    <div id="Main" style="display:none;">
      <div id="CurrentComputer" style="display:none"></div>
      <div style="text-align:right;">
      <span class="Link" style="font-weight:bold;" onclick="javascript:toggleAll();">Expand/Collapse All</span>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('OS');"  class="InfoSectionHeader">Operating System / General</div>
        <div id="OS" class="InfoSectionBody" ></div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('Processes');"  class="InfoSectionHeader">Running Processes</div>
        <div id="Processes" class="InfoSectionBody">
            Auto Refresh Interval:<select id="ProcessAutoRefresh" onchange="SetProcessAutoRefresh">
              <option value ="0">None</option>
              <option value ="1000">1 second</option>
              <option value ="2000">2 seconds</option>
              <option value ="3000">3 seconds</option>
              <option value ="5000">5 seconds</option>
              <option value ="10000">10 seconds</option>
              <option value ="20000">20 seconds</option>
              <option value ="30000">30 seconds</option>
              <option value ="60000">1 minute</option>
            </select>
            Filter (Optional):<input id="txtProcessFilter"></input>
            <br/><br/>
            <span onclick="RefreshProcesses()" style=""font-weight:bold"" class="Link">Refresh Processes</span>
            <br/><br/>
     
               <div id="ProcessesData"></div>
            </div>
            <div id="ProcessSort" style="display:none">Name</div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('Memory');"  class="InfoSectionHeader">Memory</div>
        <div id="Memory" class="InfoSectionBody"></div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('LogicalDisk');"  class="InfoSectionHeader">Logical Disk</div>
        <div id="LogicalDisk" class="InfoSectionBody"></div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('PhysicalDisk');" class="InfoSectionHeader">Physical Disk</div>
        <div id="PhysicalDisk" class="InfoSectionBody"></div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('Processor');"  class="InfoSectionHeader">Processor</div>
        <div id="Processor" class="InfoSectionBody"></div>
      </div>
      <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('Shares');"  class="InfoSectionHeader">Shares</div>
        <div id="Shares" class="InfoSectionBody"></div>
      </div>
        <div class="InfoSection">
        <div onClick="javascript:toggleDisplay('Users');"  class="InfoSectionHeader">Users</div>
        <div id="Users" class="InfoSectionBody"></div>
      </div>
    </div>
    <div id="DisplayError"></div>
    <div id="Footer">
    <hr/>
      <div style="float:left;">Version 1.1</div>
      <div style="float:right;">By David Wiseman<br />
       </div>
        <div style="clear:both;"></div>
        <div style="text-align:center;font-size:20px;font-weight:bold"><a href="http://www.wisesoft.co.uk">www.wisesoft.co.uk</a></div>
    </div>
    </body>
    </html>

  9. #9
    Membre averti
    Homme Profil pro
    Administrateur systèmes et réseaux
    Inscrit en
    Novembre 2011
    Messages
    163
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Administrateur systèmes et réseaux
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Novembre 2011
    Messages : 163
    Points : 304
    Points
    304
    Par défaut
    Bonjour Hackoofr !

    Voilà encore un outil bien pratique. Merci pour ce partage.

    Bon au niveau code, c'est du lourd, il va me falloir quelques temps pour ingurgiter tout ça.
    Je te ferai part de mes progrès !

    J'apprécie tes suggestions en tous cas !
    ++

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Affichage dynamique de liste
    Par na$DaL dans le forum Android
    Réponses: 4
    Dernier message: 20/07/2010, 11h20
  2. affichage dynamique selon parametre d'url "id"
    Par ploufleouf74 dans le forum Langage
    Réponses: 2
    Dernier message: 08/07/2009, 10h20
  3. affichage selon liste choix
    Par papagei2 dans le forum Modélisation
    Réponses: 3
    Dernier message: 27/09/2007, 16h32
  4. Problème d'affichage dynamique d'une liste
    Par bor1s dans le forum ASP
    Réponses: 2
    Dernier message: 18/11/2005, 16h18
  5. Réponses: 10
    Dernier message: 04/05/2004, 16h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo