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 :

Sauvergarder des données saisies d'une interface HTA et les sauvegarder dans un fichier grâce à un VBS.


Sujet :

VBScript

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Expert technique poste de travail
    Inscrit en
    Octobre 2013
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Expert technique poste de travail

    Informations forums :
    Inscription : Octobre 2013
    Messages : 27
    Points : 37
    Points
    37
    Par défaut Sauvergarder des données saisies d'une interface HTA et les sauvegarder dans un fichier grâce à un VBS.
    Bonjour,

    Je continue mon petit outil permettant de configurer les paramètres réseau tel que l'IP, la passserelle, le masque et les DNS.

    J'ai voulue ajouter un petit complément permettant à l'utilisateur de sauvegarder une configuration mais aussi de la restaurer, pour l'instant, je ne suis qu'à l'étape de la sauvegarde et je ne trouve pas de solution à mon problème qui est le suivant.

    - La sauvegarde s'effectue correctement lorsque je clique sur le bouton sauvegarder
    - Les paramètres sont correctement écris dans mon fichier

    Le seul problème, c'est qu'ils s'écrivent plusieurs fois, c'est à dire que par exemple, si je rentre quelques paramètres, ceux ci sont automatiquement sauvegarder alors que j'ai pourtant préciser que la fonction "AjouterIP" (Fonction de sauvegarde) ne serait appelé uniquement lorsque que l'on clique sur le bouton sauvegarder.
    Or, quand j'ouvre mon fichier où les paramètres sont sauvegardés, je constate que ceux ci ont été écris plusieurs fois à mon insu.

    J'ai l'impression que ma fonction s'appelle indépendamment du bouton et écris donc plusieurs fois dans mon fichier pour une même configuration alors que je devrais n'avoir qu'une seule configuration sauvegardée, et cela uniquement lorsque je clique sur le bouton sauvegarder.

    Bien évidemment, si je clique plusieurs fois sur ce bouton, cela écrit cette même configuration plusieurs fois dans mon fichier.

    J'espère que je me suis fais correctement comprendre sur mes attentes et mes problèmes dans la réalisation de mes besoins;

    Merci à vous, (Particulièrement à HackooFr qui m'a permis de publier une première version)

    Cordialement

    Cristalinz.



    PS : Veuillez trouver mon code ci joint


    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
    <html>
    <HTA:APPLICATION 
    ICON="laposte.ico"
    SCROLL="no"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="yes"
    SYSMENU="yes"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no">
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
    <head> 
    <OBJECT ID="objShell" CLASSID="clsid:{72C24DD5-D70A-438B-8A42-98424B88AFB8}" ProgID="WScript.Shell.1"></OBJECT> 
    <title>NewChangeIP 1.0.0</title>
    <style type='text/css'>
    BODY {background:ButtonFace;} 
    .button {
    border-size: 0px;
    border-style: none;
    background: inherit;
    width: 120px;
    font-size:14px;
    color: blue;
    cursor: hand;
    cursor: pointer;
    padding: 0px;
    border-radius: 10px 10px 10px 10px;
    }
     
    input {
    background-color:ButtonFace;
    text-align:center;
    }
     
    body
    {
    background-color:#9DC5FF;
     
    }
    .Intro
    {
    background-color:#5195FA;
    align:center;
    height : 30px;
    width : 100%;
    font:bold;
    border-radius: 10px 10px 10px 10px;
    }
     
    </style>
    </head>
    <body>  
    <table border="2" width="315">
    <tr>
    <td><SPAN class="intro"><center>Changement d'adresse IP</center></SPAN> </td>
    </tr>
    </table>
    <table border="2">
     
    <td>Intitulé IP:</td>
    <td class="blue">
    <input maxlength="27" type='text'  class="IP" onKeyUp="AjouterIP()" name="Intitule" size="27"></td><tr>
     
    <td>Adresse IP :</td> 
    <td class="blue">
    <input maxlength="3" type='text' class="IP" onKeyUp="IPCheckAdrIpStation01()" name="AdrIpStation01" size="3">
    <input maxlength="3" type='text'  class="IP" onKeyUp="IPCheckAdrIpStation02()" name="AdrIpStation02" size="3">
    <input maxlength="3" type='text'  class="IP" onKeyUp="IPCheckAdrIpStation03()" name="AdrIpStation03" size="3">
    <input maxlength="3" type='text'  class="IP" onKeyUp="IPCheckAdrIpStation04()" name="AdrIpStation04" size="3"></td><tr>
     
    <td>Masque:</td>
    <td class="blue">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrSmStation01()" name="AdrSmStation01" size="3" value="255">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrSmStation02()" name="AdrSmStation02" size="3" value="255">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrSmStation03()" name="AdrSmStation03" size="3" value="255">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrSmStation04()" name="AdrSmStation04" size="3" value="0"></td><tr>
     
    <td>Passerelle:</td>
    <td class="blue"> 
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrRouStation01()" name="AdrRouStation01" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrRouStation02()" name="AdrRouStation02" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrRouStation03()" name="AdrRouStation03" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrRouStation04()" name="AdrRouStation04" size="3" value="1"></td><tr>
     
    <td>Adresse DNS 1 :</td>
    <td class="blue"> 
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS101()" name="AdrIpDNS101" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS102()" name="AdrIpDNS102" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS103()" name="AdrIpDNS103" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS104()" name="AdrIpDNS104" size="3"></td><tr>
     
     
    <td>Adresse DNS 2 :</td>
    <td class="blue"> 
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS201()" name="AdrIpDNS201" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS202()" name="AdrIpDNS202" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS203()" name="AdrIpDNS203" size="3">
    <input maxlength="3" type='text'  class="IP"  onKeyUp="IpCheckAdrIpDNS204()" name="AdrIpDNS204" size="3"></td><tr>
    <tr>
    </table>
    <center><INPUT TYPE="button" NAME="button"style="width:55px" VALUE="OK" onclick="Valider()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    		<INPUT TYPE="button" NAME="button" VALUE="Annuler" onclick="Annuler()">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    		<INPUT TYPE="button" NAME="button" VALUE="Sauvergarder" onclick="AjouterIP()">
    </center>
     
    <script language="VBScript" defer=true>
    window.moveTo 510,200
    Sub Window_OnLoad
    	CenterWindow 360,315
    End Sub
     
    Set fso=CreateObject("Scripting.filesystemObject")
    sourcepath = objShell.CurrentDirectory
    PathFichParam=sourcepath & "\param"
     
    Sub CenterWindow(x,y)
    	window.resizeTo x, y
    	iLeft = window.screen.availWidth/2 - x/2
    	itop = window.screen.availHeight/2 - y/2
    	window.moveTo ileft, itop
    End Sub
     
    Sub LireParams(path)
     
    	on error resume next
     
    	Set thefile=fso.OpenTextFile(path, 1)
     
    	Do While theFile.AtEndOfStream <> True
    		line = theFile.ReadLine
    		chaine = LCase(left(line, Instr(line, "=")))
    		If (chaine = "type=") Then
    			TypeReseau = Mid(line, Instr(line, "=")+1)	
    		End If
    		If (chaine = "ip=") Then
    			AdrIP = Mid(line, Instr(line, "=")+1)	
    		End If
    		If (chaine = "masque=") Then
    			Masque = Mid(line, Instr(line, "=")+1)
    		End if
    		If (chaine = "passerelle=") Then
    			Passerelle = Mid(line, Instr(line, "=")+1)
    		End if
    		If (chaine = "dns1=") Then
    			AdrDNS1 = Mid(line, Instr(line, "=")+1)
    		End if
    		If (chaine = "dns2=") Then
    			AdrDNS2 = Mid(line, Instr(line, "=")+1)
    		End if
    	Loop
    	theFile.Close
    End Sub
     
    Sub AjouterIP()
     
    	Const ForReading = 1, ForWriting = 2, ForAppending = 8
    	Sleep "1"
     
    	if not fso.FileExists(PathFichParam&"\preferes.ini") then
    		fso.CreateTextFile PathFichParam&"\preferes.ini"
    	end if	
     
    	Set fichIP=fso.OpenTextFile(PathFichParam&"\preferes.ini",ForAppending)
     
    	fichIP.WriteLine ("Intitule=") & Intitule.value
    	fichIP.WriteLine ("IP=") & AdrIpStation01.value & "." & AdrIpStation02.value & "." & AdrIpStation03.value & "." & AdrIpStation04.value
    	fichIP.WriteLine ("Masque=") & AdrSmStation01.value & "." & AdrSmStation02.value & "." & AdrSmStation03.value & "." & AdrSmStation04.value
    	fichIP.WriteLine ("Passerelle=") & AdrRouStation01.value & "." & AdrRouStation02.value & "." & AdrRouStation03.value & "." & AdrRouStation04.value
    	fichIP.WriteLine ("DNS1=") & AdrIpDNS101.value & "." & AdrIpDNS102.value & "." & AdrIpDNS103.value & "." & AdrIpDNS104.value
    	fichIP.WriteLine ("DNS2=") & AdrIpDNS201.value & "." & AdrIpDNS202.value & "." & AdrIpDNS203.value & "." & AdrIpDNS204.value
    	fichIP.WriteLine ""
    	fichIP.close
    	nbrIP=0
     
    End Sub
     
    Sub Valider()
     
    	Dim Ips
    	Dim Masques
    	Dim Gateways
    	Dim DNS1
    	Dim DNS2
     
    	Ips = AdrIpStation01.value & "." & AdrIpStation02.value & "." & AdrIpStation03.value & "." & AdrIpStation04.value
    	Masques = AdrSmStation01.value & "." & AdrSmStation02.value & "." & AdrSmStation03.value & "." & AdrSmStation04.value
    	Gateways = AdrRouStation01.value & "." & AdrRouStation02.value & "." & AdrRouStation03.value & "." & AdrRouStation04.value
    	DNS1 =AdrIpDNS101.value & "." & AdrIpDNS102.value & "." & AdrIpDNS103.value & "." & AdrIpDNS104.value
    	DNS2 =AdrIpDNS201.value & "." & AdrIpDNS202.value & "." & AdrIpDNS203.value & "." & AdrIpDNS204.value
     
    	objShell.Run "netsh interface ip set address name=""Connexion au réseau local"" static " & Ips & " " & Masques & " " & Gateways & " " & 1, 0, True
    	objShell.Run "netsh interface ip set dns name=""Connexion au réseau local"" static "& DNS1, 0, True
    	objShell.Run "netsh interface ip add dns name=""Connexion au réseau local"" addr="& DNS2, 0, True	
    	MsgBox "Changement d'ip appliqué avec succès !" ,vbInformation+VBtittle
     
    End Sub
     
    Sub Annuler()
    	MsgBox "Abandon du changement de l'adresse IP et application des paramètres par défauts",vbInformation+VBtittle,"Assistant Création collection"
    	objShell.Run "netsh interface IPv4 set address name=""Connexion au réseau local"" DHCP", 0, True
    	objShell.Run "netsh interface ip set wins ""Connexion au réseau local"" DHCP", 0, True
    	objShell.Run "netsh interface ip set dns ""Connexion au réseau local"" DHCP", 0, True
    End Sub
     
    Sub IPCheckAdrIpStation01()
    	On Error Resume Next
    	If AdrIpStation01.Value > 255 OR IsNumeric(AdrIpStation01.Value) = False  Then
    		AdrIpStation01.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpStation01.Value = ""
    		AdrIpStation01.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpStation01.Value) = 3 OR InStr(AdrIpStation01.Value, ".") > 0 Then
    		AdrIpStation01.Value=Replace(AdrIpStation01.Value,".","")
    		AdrIpStation02.Focus
    		AdrIpStation02.Select
    	End If
    End Sub
     
    Sub IPCheckAdrIpStation02()
    	On Error Resume Next
    	If AdrIpStation02.Value > 255 OR IsNumeric(AdrIpStation02.Value) = False  Then
    		AdrIpStation02.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpStation02.Value = ""
    		AdrIpStation02.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpStation02.Value) = 3 OR InStr(AdrIpStation02.Value, ".") > 0 Then
    		AdrIpStation02.Value=Replace(AdrIpStation02.Value,".","")
    		AdrIpStation03.Focus
    		AdrIpStation03.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpStation03()
    	On Error Resume Next
    	If AdrIpStation03.Value > 255 OR IsNumeric(AdrIpStation03.Value) = False  Then
    		AdrIpStation03.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpStation03.Value = ""
    		AdrIpStation03.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpStation03.Value) = 3 OR InStr(AdrIpStation03.Value, ".") > 0 Then
    		AdrIpStation03.Value=Replace(AdrIpStation03.Value,".","")
    		AdrIpStation04.Focus
    		AdrIpStation04.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpStation04()
    	On Error Resume Next
    	If AdrIpStation04.Value > 255 OR IsNumeric(AdrIpStation04.Value) = False  Then
    		AdrIpStation04.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpStation04.Value = ""
    		AdrIpStation04.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpStation04.Value) = 3 OR InStr(AdrIpStation04.Value, ".") > 0 Then
    		AdrIpStation04.Value=Replace(AdrIpStation04.Value,".","")
    		AdrSmStation01.Focus
    		AdrSmStation01.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrSmStation01()
    	On Error Resume Next
    	If AdrSmStation01.Value > 255 OR IsNumeric(AdrSmStation01.Value) = False  Then
    		AdrSmStation01.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrSmStation01.Value = ""
    		AdrSmStation01.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrSmStation01.Value) = 3 OR InStr(AdrSmStation01.Value, ".") > 0 Then
    		AdrSmStation01.Value=Replace(AdrSmStation01.Value,".","")
    		AdrSmStation02.Focus
    		AdrSmStation02.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrSmStation02()
    	On Error Resume Next
    	If AdrSmStation02.Value > 255 OR IsNumeric(AdrSmStation02.Value) = False  Then
    		AdrSmStation02.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrSmStation02.Value = ""
    		AdrSmStation02.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrSmStation02.Value) = 3 OR InStr(AdrSmStation02.Value, ".") > 0 Then
    		AdrSmStation02.Value=Replace(AdrSmStation02.Value,".","")
    		AdrSmStation03.Focus
    		AdrSmStation03.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrSmStation03()
    	On Error Resume Next
    	If AdrSmStation03.Value > 255 OR IsNumeric(AdrSmStation03.Value) = False  Then
    		AdrSmStation03.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrSmStation03.Value = ""
    		AdrSmStation03.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrSmStation03.Value) = 3 OR InStr(AdrSmStation03.Value, ".") > 0 Then
    		AdrSmStation03.Value=Replace(AdrSmStation03.Value,".","")
    		AdrSmStation04.Focus
    		AdrSmStation04.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrSmStation04()
    	On Error Resume Next
    	If AdrSmStation04.Value > 255 OR IsNumeric(AdrSmStation04.Value) = False  Then
    		AdrSmStation04.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrSmStation04.Value = ""
    		AdrSmStation04.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrSmStation04.Value) = 3 OR InStr(AdrSmStation04.Value, ".") > 0 Then
    		AdrSmStation04.Value=Replace(AdrSmStation04.Value,".","")
    		AdrIpDNS101.Focus
    		AdrIpDNS101.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrRouStation01()
    	On Error Resume Next
    	If AdrRouStation01.Value > 255 OR IsNumeric(AdrRouStation01.Value) = False  Then
    		AdrRouStation01.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrRouStation01.Value = ""
    		AdrRouStation01.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrRouStation01.Value) = 3 OR InStr(AdrRouStation01.Value, ".") > 0 Then
    		AdrRouStation01.Value=Replace(AdrRouStation01.Value,".","")
    		AdrRouStation02.Focus
    		AdrRouStation02.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrRouStation02()
    	On Error Resume Next
    	If AdrRouStation02.Value > 255 OR IsNumeric(AdrRouStation02.Value) = False  Then
    		AdrRouStation02.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrRouStation02.Value = ""
    		AdrRouStation02.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrRouStation02.Value) = 3 OR InStr(AdrRouStation02.Value, ".") > 0 Then
    		AdrRouStation02.Value=Replace(AdrRouStation02.Value,".","")
    		AdrRouStation03.Focus
    		AdrRouStation03.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrRouStation03()
    	On Error Resume Next
    	If AdrRouStation03.Value > 255 OR IsNumeric(AdrRouStation03.Value) = False  Then
    		AdrRouStation03.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrRouStation03.Value = ""
    		AdrRouStation03.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrRouStation03.Value) = 3 OR InStr(AdrRouStation03.Value, ".") > 0 Then
    		AdrRouStation03.Value=Replace(AdrRouStation03.Value,".","")
    		AdrRouStation04.Focus
    		AdrRouStation04.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrRouStation04()
    	On Error Resume Next
    	If AdrRouStation04.Value > 255 OR IsNumeric(AdrRouStation04.Value) = False  Then
    		AdrRouStation04.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrRouStation04.Value = ""
    		AdrRouStation04.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrRouStation04.Value) = 3 OR InStr(AdrRouStation04.Value, ".") > 0 Then
    		AdrRouStation04.Value=Replace(AdrRouStation04.Value,".","")
    		AdrIpDNS101.Focus
    		AdrIpDNS101.Select
    	End If
    End Sub 
     
    Sub IPCheckAdrIpDNS101()
    	On Error Resume Next
    	If AdrIpDNS101.Value > 255 OR IsNumeric(AdrIpDNS101.Value) = False  Then
    		AdrIpDNS101.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS101.Value = ""
    		AdrIpDNS101.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS101.Value) = 3 OR InStr(AdrIpDNS101.Value, ".") > 0 Then
    		AdrIpDNS101.Value=Replace(AdrIpDNS101.Value,".","")
    		AdrIpDNS102.Focus
    		AdrIpDNS102.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS102()
    	On Error Resume Next
    	If AdrIpDNS102.Value > 255 OR IsNumeric(AdrIpDNS102.Value) = False  Then
    		AdrIpDNS102.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS102.Value = ""
    		AdrIpDNS102.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS102.Value) = 3 OR InStr(AdrIpDNS102.Value, ".") > 0 Then
    		AdrIpDNS102.Value=Replace(AdrIpDNS102.Value,".","")
    		AdrIpDNS103.Focus
    		AdrIpDNS103.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS103()
    	On Error Resume Next
    	If AdrIpDNS103.Value > 255 OR IsNumeric(AdrIpDNS103.Value) = False  Then
    		AdrIpDNS103.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS103.Value = ""
    		AdrIpDNS103.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS103.Value) = 3 OR InStr(AdrIpDNS103.Value, ".") > 0 Then
    		AdrIpDNS103.Value=Replace(AdrIpDNS103.Value,".","")
    		AdrIpDNS104.Focus
    		AdrIpDNS104.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS104()
    	On Error Resume Next
    	If AdrIpDNS104.Value > 255 OR IsNumeric(AdrIpDNS104.Value) = False  Then
    		AdrIpDNS104.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS104.Value = ""
    		AdrIpDNS104.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS104.Value) = 3 OR InStr(AdrIpDNS104.Value, ".") > 0 Then
    		AdrIpDNS104.Value=Replace(AdrIpDNS104.Value,".","")
    		AdrIpDNS201.Focus
    		AdrIpDNS201.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS201()
    	On Error Resume Next
    	If AdrIpDNS201.Value > 255 OR IsNumeric(AdrIpDNS201.Value) = False  Then
    		AdrIpDNS201.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS201.Value = ""
    		AdrIpDNS201.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS201.Value) = 3 OR InStr(AdrIpDNS201.Value, ".") > 0 Then
    		AdrIpDNS201.Value=Replace(AdrIpDNS201.Value,".","")
    		AdrIpDNS202.Focus
    		AdrIpDNS202.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS202()
    	On Error Resume Next
    	If AdrIpDNS202.Value > 255 OR IsNumeric(AdrIpDNS202.Value) = False  Then
    		AdrIpDNS202.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS202.Value = ""
    		AdrIpDNS202.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS202.Value) = 3 OR InStr(AdrIpDNS202.Value, ".") > 0 Then
    		AdrIpDNS202.Value=Replace(AdrIpDNS202.Value,".","")
    		AdrIpDNS203.Focus
    		AdrIpDNS203.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS203()
    	On Error Resume Next
    	If AdrIpDNS203.Value > 255 OR IsNumeric(AdrIpDNS203.Value) = False  Then
    		AdrIpDNS203.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS203.Value = ""
    		AdrIpDNS203.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS203.Value) = 3 OR InStr(AdrIpDNS203.Value, ".") > 0 Then
    		AdrIpDNS203.Value=Replace(AdrIpDNS203.Value,".","")
    		AdrIpDNS204.Focus
    		AdrIpDNS204.Select
    	End If
    End Sub    
     
    Sub IPCheckAdrIpDNS204()
    	On Error Resume Next
    	If AdrIpDNS204.Value > 255 OR IsNumeric(AdrIpDNS204.Value) = False  Then
    		AdrIpDNS204.style.backgroundcolor = "red"
    		Sleep "1"
    		AdrIpDNS204.Value = ""
    		AdrIpDNS204.style.backgroundcolor = "Buttonface"
    	End If
    	If Len(AdrIpDNS204.Value) = 3 OR InStr(AdrIpDNS204.Value, ".") > 0 Then
    		AdrIpDNS204.Value=Replace(AdrIpDNS204.Value,".","")
    		Check.Focus
    		Check.Select
    	End If
    End Sub    
     
    Sub Sleep(MSecs)
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	Dim tempFolder : Set tempFolder = fso.GetSpecialFolder(2)
    	Dim tempName : tempName = "Sleeper.vbs"
    	If Fso.FileExists(tempFolder&"\"&tempName)=False Then
    		Set objOutputFile = fso.CreateTextFile(tempFolder&"\"&tempName, True)
    		objOutputFile.Write "wscript.sleep WScript.Arguments(0)"
    		objOutputFile.Close
    	End If
    	CreateObject("WScript.Shell").Run tempFolder&"\"&tempName &" "& MSecs,1,True
    End Sub
    </script>
    </body>
    </html>

  2. #2
    Modérateur
    Avatar de ProgElecT
    Homme Profil pro
    Retraité
    Inscrit en
    Décembre 2004
    Messages
    6 077
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 68
    Localisation : France, Haute Savoie (Rhône Alpes)

    Informations professionnelles :
    Activité : Retraité
    Secteur : Communication - Médias

    Informations forums :
    Inscription : Décembre 2004
    Messages : 6 077
    Points : 17 169
    Points
    17 169
    Par défaut
    Salut

    Ligne 67, chaque appuis sur une touche du clavier appel la fonction AjouterIP
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <input maxlength="27" type='text'  class="IP" onKeyUp="AjouterIP()" name="Intitule" size="27"></td><tr>
    Soyez sympa, pensez -y
    Balises[CODE]...[/CODE]
    Balises[CODE=NomDuLangage]...[/CODE] quand vous mettez du code d'un autre langage que celui du forum ou vous postez.
    Balises[C]...[/C] code intégré dans une phrase.
    Balises[C=NomDuLangage]...[/C] code intégré dans une phrase quand vous mettez du code d'un autre langage que celui du forum ou vous postez.
    Le bouton en fin de discussion, quand vous avez obtenu l'aide attendue.
    ......... et pourquoi pas, pour remercier, un pour celui/ceux qui vous ont dépannés.
    👉 → → Ma page perso sur DVP ← ← 👈

  3. #3
    Nouveau membre du Club
    Homme Profil pro
    Expert technique poste de travail
    Inscrit en
    Octobre 2013
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Expert technique poste de travail

    Informations forums :
    Inscription : Octobre 2013
    Messages : 27
    Points : 37
    Points
    37
    Par défaut
    Bonjour,

    D'accord merci, c'est très pratique d'avoir un autre oeil sur le sujet car je ne cherchais pas au bon endroit.
    Encore merci !

  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
    Cristalinz
    On voit bien que ton soft progresse , alors n'oublies pas de partager ta version finale dans la section Téléchargements ça peut-être utile pour d'autres personnes.

  5. #5
    Nouveau membre du Club
    Homme Profil pro
    Expert technique poste de travail
    Inscrit en
    Octobre 2013
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Expert technique poste de travail

    Informations forums :
    Inscription : Octobre 2013
    Messages : 27
    Points : 37
    Points
    37
    Par défaut
    Oui dès que je l'ai finis je publierai une version finale !

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

Discussions similaires

  1. [Débutant] Importer des données Excel sur une interface Visual Studio
    Par Nicoow44 dans le forum Visual Studio
    Réponses: 0
    Dernier message: 07/07/2014, 11h48
  2. [Généralités] Sauvegarde des données saisies d'une application Windev dans un disque DVD
    Par zonoelson dans le forum WinDev
    Réponses: 6
    Dernier message: 14/01/2014, 06h54
  3. Réponses: 2
    Dernier message: 10/07/2012, 14h51
  4. Réponses: 4
    Dernier message: 25/07/2011, 21h50
  5. Réponses: 0
    Dernier message: 02/04/2011, 12h57

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