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] Boîte de saisie avec contrôle de validité d'adresses IP


Sujet :

VBScript

  1. #1
    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 [HTA] Boîte de saisie avec contrôle de validité d'adresses IP

    Je suis un peu fatigué et je ne trouve pas mon erreur peut-être elle est si simple mais une petite aide de votre part s'impose
    Bon, je veux contrôler la validité des adresses ip saisi par l'utilisateur, mais je ne récupère aucune quand je veux faire une concaténation
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    Dim IP
    Dim Masque
    Dim Passerelle
    Dim DNS1
    Dim DNS2
        IP = N1.Value &"."& N2.Value &"."& N3.Value &"."& N4.Value 
        Masque = N5.Value &"."& N6.Value &"."& N7.Value &"."& N8.Value
        Passerelle = N9.Value &"."& N10.Value &"."& N11.Value &"."& N12.Value
        DNS1 = N13.Value &"."& N14.Value &"."& N15.Value &"."& N16.Value
        DNS2 = N17.Value &"."& N18.Value &"."& N19.Value &"."& N20.Value
    Le Code Complet en 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
    <html>
    <HTA:APPLICATION 
    APPLICATIONNAME="Set IP config"
    SCROLL="no"
    SINGLEINSTANCE="yes"
    ICON="nslookup.exe"
    MAXIMIZEBUTTON="no"
    WINDOWSTATE="no">
    <style type='text/css'>
    input {width:21px;
    border:0px;
    font-size:10px;
    background-color:lightcyan;
    font-weight:bold;
    text-align:center;
    }
    BODY {background:lightcyan;} 
     
    .button {
    border-size: 0px;
    border-style: none;
    background: inherit;
    width: 120px;
    font-size:14px;
    color: blue;
    cursor: hand;
    cursor: pointer;
    padding: 0px;
    }
    </style>
    </head>
    <title>Saisie des adresses IP</title>
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <script language="VBScript">
    Dim IP
    Dim Masque
    Dim Passerelle
    Dim DNS1
    Dim DNS2
        IP = N1.Value &"."& N2.Value &"."& N3.Value &"."& N4.Value 
        Masque = N5.Value &"."& N6.Value &"."& N7.Value &"."& N8.Value
        Passerelle = N9.Value &"."& N10.Value &"."& N11.Value &"."& N12.Value
        DNS1 = N13.Value &"."& N14.Value &"."& N15.Value &"."& N16.Value
        DNS2 = N17.Value &"."& N18.Value &"."& N19.Value &"."& N20.Value
     
    Sub Window_OnLoad
        CenterWindow 320,350
    End Sub
     
    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
     
    Function IP_Valide(ip)
        Set RegularExpressionObject = New RegExp
        With RegularExpressionObject
            .Pattern = "\b((25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(25[0-5]|2[0-4]\d|1?\d?\d)\b"
            .IgnoreCase = False
            If .Test(ip)= True then
                IP_Valide = True
            end if
        End With
    End Function
     
    Sub CheckIP()
        If Not IP_Valide(IP) Then
        MsgBox IP
            MsgBox "L'adresse IP que vous avez saisi "&IP&vbcr&" est non valide",16,"L'adresse IP que vous avez saisi est non valide"
            N1.Focus()
        End If
     
        If Not IP_Valide(Masque) Then
            MsgBox "L'adresse IP du masque sous-réseau que vous avez saisi est non valide",16,"L'adresse IP du masque sous-réseau que vous avez saisi est non valide"
            MsgBox Masque
            N2.Focus()
        End If
     
        If Not IP_Valide(Passerelle) Then
            MsgBox "L'adresse IP de la Passerelle par défaut que vous avez saisi est non valide",16,"L'adresse IP de la Passerelle par défaut que vous avez saisi est non valide"
            N3.Focus()
        End If
     
        If Not IP_Valide(DNS1) Then
            MsgBox "L'adresse IP de DNS1 que vous avez saisi est non valide",16,"L'adresse IP de DNS1 que vous avez saisi est non valide"
            N4.Focus()
        End If
     
        If Not IP_Valide(DNS2) Then
            MsgBox "L'adresse IP de DNS2 que vous avez saisi est non valide",16,"L'adresse IP de DNS2 que vous avez saisi est non valide"
            N5.Focus()
        End If 
     
        If IP_Valide(IP) And IP_Valide(Masque) And IP_Valide(Passerelle) And IP_Valide(DNS1) And IP_Valide(DNS2) Then
            MsgBox "IP : "&IP&vbCr&"Masque sous réseau : "&Masque&vbCr&"Passerelle par défaut : "&Passerelle&vbCr&_
            "DNS1 : "& DNS1&vbCr&"DNS2 : "& DNS2,64,"Les @ IP"
        End If
    End Sub
     
    </script>
    <body>
    <fieldset>
    <legend>Utiliser l'adresse IP suivante</legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Adresse IP Locale :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N1" /><b>.</b><input type='text' class="IP" maxLength="3" name="N2"/><b>.</b><input type='text' class="IP" maxLength="3" name="N3"/><b>.</b><input type='text' class="IP" maxLength="3" name="N4" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Masque sous-réseau :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N5" /><b>.</b><input type='text' class="IP" maxLength="3" name="N6" /><b>.</b><input type='text' class="IP" maxLength="3" name="N7"/><b>.</b><input type='text' class="IP" maxLength="3" name="N8" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Passerelle par défaut :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N9" /><b>.</b><input type='text' class="IP" maxLength="3" name="N10"/><b>.</b><input type='text' class="IP" maxLength="3" name="N11" /><b>.</b><input type='text' class="IP" maxLength="3" name="N12" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <fieldset>
    <legend>Utiliser l'adresse DNS suivante </legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 1 : &nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N13" /><b>.</b><input type='text' class="IP" maxLength="3" name="N14" /><b>.</b><input type='text' class="IP" maxLength="3" name="N15" /><b>.</b><input type='text' class="IP" maxLength="3" name="N16" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 2 :&nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N17" /><b>.</b><input type='text' class="IP" maxLength="3" name="N18" /><b>.</b><input type='text' class="IP" maxLength="3" name="N19" /><b>.</b><input type='text' class="IP" maxLength="3" name="N20" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <center><input type="Submit" class="button" style="cursor:hand;" value="Vérifier les @IP" name="Check"  onClick="CheckIP()" style="font-weight: bold">
    <input type="button" class="button" style="cursor:hand;" value="IP Publique" name="Reload"  onClick="TestConnexion()" style="font-weight: bold"><p> 
    <body>
    </html>


  2. #2
    Membre confirmé Avatar de pitchalov
    Homme Profil pro
    Inscrit en
    Avril 2007
    Messages
    340
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 340
    Points : 582
    Points
    582
    Par défaut
    Bonjour,

    "Tu ne récupères aucune quand tu veux faire une concaténation." ???
    Ca veut dire que tes variables IP, Masque, ..., DNS2 ne contiennent pas les chaines concaténées?

    Si c'est le cas : les chaines N1.Value, ... N20.Value contiennent-ils bien les données que tu souhaites?
    Essaie également en mettant des espaces entre les & et les " :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    IP = N1.Value & "." & N2.Value & "." & N3.Value & "." & N4.Value
    Bonne continuation

  3. #3
    Rédacteur
    Avatar de omen999
    Profil pro
    Inscrit en
    Février 2006
    Messages
    1 296
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2006
    Messages : 1 296
    Points : 3 549
    Points
    3 549
    Par défaut
    salut,
    l'interprétation d'un fichier hta suit la logique d'un parsing html et non d'un langage de script standard (comme vbs sous wsh)
    la prog hta n'est pas adaptée à l'écriture de scripts indépendants et devrait être strictement réservée à la gestion de la GUI
    tes lignes 6 à 10 font référence à des objets qui du point du vue du parser n'existent pas encore...
    si tu veux conserver ton code dans cet état modifie la ligne 34 :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <script language="VBScript" defer=true>
    tu retarderas ainsi l'exécution du script à la fin du parsing de la page...
    nomen omen, nemo non omen - Consultez la FAQ VBScript et les cours et tutoriels VBScript
    le plus terrible lorsqu'une voiture renverse un piéton, c'est que ce sont les freins qui hurlent. (ramón)
    pas de questions techniques par mp

  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
    omen999 et pour cette remarque intéressante que je ne connaissais pas au-part avant
    Donc voici le code qui marche très bien et le problème est
    Edit : Ajout de l'IP Publique
    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
    <html>
    <HTA:APPLICATION 
    APPLICATIONNAME="Set IP config"
    SCROLL="no"
    ICON="nslookup.exe"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="yes"
    SYSMENU="yes"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no">
    <style type='text/css'>
    input {width:21px;
    border:0px;
    font-size:10px;
    background-color:lightcyan;
    font-weight:bold;
    text-align:center;
    }
    BODY {background:lightcyan;} 
     
    .button {
    border-size: 0px;
    border-style: none;
    background: inherit;
    width: 120px;
    font-size:14px;
    color: blue;
    cursor: hand;
    cursor: pointer;
    padding: 0px;
    }
    </style>
    </head>
    <title>Saisie des adresses IP</title>
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <script language="VBScript" defer=true>
    Sub Window_OnLoad
        CenterWindow 320,360
    End Sub
     
    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
     
    Function IP_Valide(ip)
        Set RegularExpressionObject = New RegExp
        With RegularExpressionObject
            .Pattern = "\b((25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(25[0-5]|2[0-4]\d|1?\d?\d)\b"
            .IgnoreCase = False
            If .Test(ip)= True then
                IP_Valide = True
            end if
        End With
    End Function
     
    Sub CheckIP()
    Dim IP
    Dim Masque
    Dim Passerelle
    Dim DNS1
    Dim DNS2
        IP = N1.Value &"."& N2.Value &"."& N3.Value &"."& N4.Value 
        Masque = N5.Value &"."& N6.Value &"."& N7.Value &"."& N8.Value
        Passerelle = N9.Value &"."& N10.Value &"."& N11.Value &"."& N12.Value
        DNS1 = N13.Value &"."& N14.Value &"."& N15.Value &"."& N16.Value
        DNS2 = N17.Value &"."& N18.Value &"."& N19.Value &"."& N20.Value
        If Not IP_Valide(IP) Then
        MsgBox IP
            MsgBox "L'adresse IP que vous avez saisi "&IP&vbcr&" est non valide",16,"L'adresse IP que vous avez saisi est non valide"
            N1.Focus()
        End If
     
        If Not IP_Valide(Masque) Then
            MsgBox "L'adresse IP du masque sous-réseau que vous avez saisi est non valide",16,"L'adresse IP du masque sous-réseau que vous avez saisi est non valide"
            MsgBox Masque
            N2.Focus()
        End If
     
        If Not IP_Valide(Passerelle) Then
            MsgBox "L'adresse IP de la Passerelle par défaut que vous avez saisi est non valide",16,"L'adresse IP de la Passerelle par défaut que vous avez saisi est non valide"
            N3.Focus()
        End If
     
        If Not IP_Valide(DNS1) Then
            MsgBox "L'adresse IP de DNS1 que vous avez saisi est non valide",16,"L'adresse IP de DNS1 que vous avez saisi est non valide"
            N4.Focus()
        End If
     
        If Not IP_Valide(DNS2) Then
            MsgBox "L'adresse IP de DNS2 que vous avez saisi est non valide",16,"L'adresse IP de DNS2 que vous avez saisi est non valide"
            N5.Focus()
        End If 
     
        If IP_Valide(IP) And IP_Valide(Masque) And IP_Valide(Passerelle) And IP_Valide(DNS1) And IP_Valide(DNS2) Then
            MsgBox "IP : "&IP&vbCr&"Masque sous réseau : "&Masque&vbCr&"Passerelle par défaut : "&Passerelle&vbCr&_
            "DNS1 : "& DNS1&vbCr&"DNS2 : "& DNS2,64,"Les @ IP"
        End If
    End Sub
     
    Sub Ip_Publique
        Dim Titre,URL,ie,objFSO,Data,OutPut,objRegex,Match,Matches
        Titre = "Adresse Ip Publique !"
        URL = "http://monip.org"
        Set ie = CreateObject("InternetExplorer.Application")
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        ie.Navigate (URL) 
        ie.Visible=false
        DO WHILE ie.busy
            Sleep 100
        LOOP
        Data = ie.document.documentElement.innertext 
        ie.Quit 
        Set ie = Nothing
        Set objRegex = new RegExp
        objRegex.Pattern = "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
        objRegex.Global = False
        objRegex.IgnoreCase = True
        Set Matches = objRegex.Execute(Data)
        For Each Match in Matches   
            ip_public.InnerHTML = Match.Value
        Next
    End Sub
     
    Sub Sleep(MSecs)' Fonction pour faire une pause car wscript.sleep ne marche pas dans un HTA 
        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>
    <fieldset>
    <legend>Utiliser l'adresse IP suivante</legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Adresse IP Locale :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N1" /><b>.</b><input type='text' class="IP" maxLength="3" name="N2"/><b>.</b><input type='text' class="IP" maxLength="3" name="N3"/><b>.</b><input type='text' class="IP" maxLength="3" name="N4" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Masque sous-réseau :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N5" /><b>.</b><input type='text' class="IP" maxLength="3" name="N6" /><b>.</b><input type='text' class="IP" maxLength="3" name="N7"/><b>.</b><input type='text' class="IP" maxLength="3" name="N8" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Passerelle par défaut :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N9" /><b>.</b><input type='text' class="IP" maxLength="3" name="N10"/><b>.</b><input type='text' class="IP" maxLength="3" name="N11" /><b>.</b><input type='text' class="IP" maxLength="3" name="N12" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <fieldset>
    <legend>Utiliser l'adresse DNS suivante </legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 1 : &nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N13" /><b>.</b><input type='text' class="IP" maxLength="3" name="N14" /><b>.</b><input type='text' class="IP" maxLength="3" name="N15" /><b>.</b><input type='text' class="IP" maxLength="3" name="N16" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 2 :&nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" name="N17" /><b>.</b><input type='text' class="IP" maxLength="3" name="N18" /><b>.</b><input type='text' class="IP" maxLength="3" name="N19" /><b>.</b><input type='text' class="IP" maxLength="3" name="N20" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <center><input type="Submit" class="button" style="cursor:hand;" value="Vérifier les @IP" name="Check"  onClick="CheckIP()" style="font-weight: bold">
    <input type="button" class="button" style="cursor:hand;" value="IP Publique" name="IP Publique"  onClick="Ip_Publique()" style="font-weight: bold"><p> 
    <center><B><font color="#669933"><span id="ip_public"></span></font></B></center>
    <body>
    </html>

  5. #5
    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 Nouvelle Version : Changement de la couleur de l'interface + fonctions de contrôle des adresses IP

    Il s'agit d'une nouvelle version avec l'erreur clignotante en rouge pour valider l'IP saisie comme elle est tapé
    Qu'en pensez-vous ?
    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
    <html>
    <HTA:APPLICATION 
    APPLICATIONNAME="Set IP config"
    SCROLL="no"
    ICON="nslookup.exe"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="yes"
    SYSMENU="yes"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no">
    <style type='text/css'>
    input {width:21px;
    border:0px;
    font-size:10px;
    background-color:ButtonFace;
    font-weight:bold;
    text-align:center;
    }
    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;
    }
    </style>
    </head>
    <title>Saisie des adresses IP</title>
    <META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    <script language="VBScript" defer=true>
    Sub Window_OnLoad
        CenterWindow 320,360
    End Sub
     
    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 IPCheckN1()
            On Error Resume Next
            If N1.Value > 223 OR IsNumeric(N1.Value) = False  Then
                N1.style.backgroundcolor = "red"
                Sleep "1"
                N1.Value = ""
                N1.style.backgroundcolor = "Buttonface"
            End If
            If Len(N1.Value) = 3 OR InStr(N1.Value, ".") > 0 Then
                N1.Value=Replace(N1.Value,".","")
                N2.Focus
                N2.Select
            End If
        End Sub
     
    Sub IPCheckN2()
            On Error Resume Next
            If N2.Value > 255 OR IsNumeric(N2.Value) = False  Then
                N2.style.backgroundcolor = "red"
                Sleep "1"
                N2.Value = ""
                N2.style.backgroundcolor = "Buttonface"
            End If
            If Len(N2.Value) = 3 OR InStr(N2.Value, ".") > 0 Then
                N2.Value=Replace(N2.Value,".","")
                N3.Focus
                N3.Select
            End If
        End Sub    
     
    Sub IPCheckN3()
            On Error Resume Next
            If N3.Value > 255 OR IsNumeric(N3.Value) = False  Then
                N3.style.backgroundcolor = "red"
                Sleep "1"
                N3.Value = ""
                N3.style.backgroundcolor = "Buttonface"
            End If
            If Len(N3.Value) = 3 OR InStr(N3.Value, ".") > 0 Then
                N3.Value=Replace(N3.Value,".","")
                N4.Focus
                N4.Select
            End If
    End Sub    
     
    Sub IPCheckN4()
            On Error Resume Next
            If N4.Value > 255 OR IsNumeric(N4.Value) = False  Then
                N4.style.backgroundcolor = "red"
                Sleep "1"
                N4.Value = ""
                N4.style.backgroundcolor = "Buttonface"
            End If
            If Len(N4.Value) = 3 OR InStr(N4.Value, ".") > 0 Then
                N4.Value=Replace(N4.Value,".","")
                N5.Focus
                N5.Select
            End If
    End Sub    
     
    Sub IPCheckN5()
            On Error Resume Next
            If N5.Value > 223 OR IsNumeric(N5.Value) = False  Then
                N5.style.backgroundcolor = "red"
                Sleep "1"
                N5.Value = ""
                N5.style.backgroundcolor = "Buttonface"
            End If
            If Len(N5.Value) = 3 OR InStr(N5.Value, ".") > 0 Then
                N5.Value=Replace(N5.Value,".","")
                N6.Focus
                N6.Select
            End If
    End Sub    
     
    Sub IPCheckN6()
            On Error Resume Next
            If N6.Value > 255 OR IsNumeric(N6.Value) = False  Then
                N6.style.backgroundcolor = "red"
                Sleep "1"
                N6.Value = ""
                N6.style.backgroundcolor = "Buttonface"
            End If
            If Len(N6.Value) = 3 OR InStr(N6.Value, ".") > 0 Then
                N6.Value=Replace(N6.Value,".","")
                N7.Focus
                N7.Select
            End If
    End Sub    
     
    Sub IPCheckN7()
            On Error Resume Next
            If N7.Value > 255 OR IsNumeric(N7.Value) = False  Then
                N7.style.backgroundcolor = "red"
                Sleep "1"
                N7.Value = ""
                N7.style.backgroundcolor = "Buttonface"
            End If
            If Len(N7.Value) = 3 OR InStr(N7.Value, ".") > 0 Then
                N7.Value=Replace(N7.Value,".","")
                N8.Focus
                N8.Select
            End If
    End Sub    
     
    Sub IPCheckN8()
            On Error Resume Next
            If N8.Value > 255 OR IsNumeric(N8.Value) = False  Then
                N8.style.backgroundcolor = "red"
                Sleep "1"
                N8.Value = ""
                N8.style.backgroundcolor = "Buttonface"
            End If
            If Len(N8.Value) = 3 OR InStr(N8.Value, ".") > 0 Then
                N8.Value=Replace(N8.Value,".","")
                N9.Focus
                N9.Select
            End If
    End Sub    
     
    Sub IPCheckN9()
            On Error Resume Next
            If N9.Value > 223 OR IsNumeric(N9.Value) = False  Then
                N9.style.backgroundcolor = "red"
                Sleep "1"
                N9.Value = ""
                N9.style.backgroundcolor = "Buttonface"
            End If
            If Len(N9.Value) = 3 OR InStr(N9.Value, ".") > 0 Then
                N9.Value=Replace(N9.Value,".","")
                N10.Focus
                N10.Select
            End If
    End Sub    
     
    Sub IPCheckN10()
            On Error Resume Next
            If N10.Value > 255 OR IsNumeric(N10.Value) = False  Then
                N10.style.backgroundcolor = "red"
                Sleep "1"
                N10.Value = ""
                N10.style.backgroundcolor = "Buttonface"
            End If
            If Len(N10.Value) = 3 OR InStr(N10.Value, ".") > 0 Then
                N10.Value=Replace(N10.Value,".","")
                N11.Focus
                N11.Select
            End If
    End Sub    
     
    Sub IPCheckN11()
            On Error Resume Next
            If N11.Value > 255 OR IsNumeric(N11.Value) = False  Then
                N11.style.backgroundcolor = "red"
                Sleep "1"
                N11.Value = ""
                N11.style.backgroundcolor = "Buttonface"
            End If
            If Len(N11.Value) = 3 OR InStr(N11.Value, ".") > 0 Then
                N11.Value=Replace(N11.Value,".","")
                N12.Focus
                N12.Select
            End If
    End Sub    
     
    Sub IPCheckN12()
            On Error Resume Next
            If N12.Value > 255 OR IsNumeric(N12.Value) = False  Then
                N12.style.backgroundcolor = "red"
                Sleep "1"
                N12.Value = ""
                N12.style.backgroundcolor = "Buttonface"
            End If
            If Len(N12.Value) = 3 OR InStr(N12.Value, ".") > 0 Then
                N12.Value=Replace(N12.Value,".","")
                N13.Focus
                N13.Select
            End If
    End Sub    
     
    Sub IPCheckN13()
            On Error Resume Next
            If N13.Value > 223 OR IsNumeric(N13.Value) = False  Then
                N13.style.backgroundcolor = "red"
                Sleep "1"
                N13.Value = ""
                N13.style.backgroundcolor = "Buttonface"
            End If
            If Len(N13.Value) = 3 OR InStr(N13.Value, ".") > 0 Then
                N13.Value=Replace(N13.Value,".","")
                N14.Focus
                N14.Select
            End If
    End Sub    
     
    Sub IPCheckN14()
            On Error Resume Next
            If N14.Value > 255 OR IsNumeric(N14.Value) = False  Then
                N14.style.backgroundcolor = "red"
                Sleep "1"
                N14.Value = ""
                N14.style.backgroundcolor = "Buttonface"
            End If
            If Len(N14.Value) = 3 OR InStr(N14.Value, ".") > 0 Then
                N14.Value=Replace(N14.Value,".","")
                N15.Focus
                N15.Select
            End If
    End Sub    
     
    Sub IPCheckN15()
            On Error Resume Next
            If N15.Value > 255 OR IsNumeric(N15.Value) = False  Then
                N15.style.backgroundcolor = "red"
                Sleep "1"
                N15.Value = ""
                N15.style.backgroundcolor = "Buttonface"
            End If
            If Len(N15.Value) = 3 OR InStr(N15.Value, ".") > 0 Then
                N15.Value=Replace(N15.Value,".","")
                N16.Focus
                N16.Select
            End If
    End Sub    
     
    Sub IPCheckN16()
            On Error Resume Next
            If N16.Value > 255 OR IsNumeric(N16.Value) = False  Then
                N16.style.backgroundcolor = "red"
                Sleep "1"
                N16.Value = ""
                N16.style.backgroundcolor = "Buttonface"
            End If
            If Len(N16.Value) = 3 OR InStr(N16.Value, ".") > 0 Then
                N16.Value=Replace(N16.Value,".","")
                N17.Focus
                N17.Select
            End If
    End Sub    
     
    Sub IPCheckN17()
            On Error Resume Next
            If N17.Value > 223 OR IsNumeric(N17.Value) = False  Then
                N17.style.backgroundcolor = "red"
                Sleep "1"
                N17.Value = ""
                N17.style.backgroundcolor = "Buttonface"
            End If
            If Len(N17.Value) = 3 OR InStr(N17.Value, ".") > 0 Then
                N17.Value=Replace(N17.Value,".","")
                N18.Focus
                N18.Select
            End If
    End Sub    
     
    Sub IPCheckN18()
            On Error Resume Next
            If N18.Value > 255 OR IsNumeric(N18.Value) = False  Then
                N18.style.backgroundcolor = "red"
                Sleep "1"
                N18.Value = ""
                N18.style.backgroundcolor = "Buttonface"
            End If
            If Len(N18.Value) = 3 OR InStr(N18.Value, ".") > 0 Then
                N18.Value=Replace(N18.Value,".","")
                N19.Focus
                N19.Select
            End If
    End Sub    
     
    Sub IPCheckN19()
            On Error Resume Next
            If N19.Value > 255 OR IsNumeric(N19.Value) = False  Then
                N19.style.backgroundcolor = "red"
                Sleep "1"
                N19.Value = ""
                N19.style.backgroundcolor = "Buttonface"
            End If
            If Len(N19.Value) = 3 OR InStr(N19.Value, ".") > 0 Then
                N19.Value=Replace(N19.Value,".","")
                N20.Focus
                N20.Select
            End If
    End Sub    
     
    Sub IPCheckN20()
            On Error Resume Next
            If N20.Value > 255 OR IsNumeric(N20.Value) = False  Then
                N20.style.backgroundcolor = "red"
                Sleep "1"
                N20.Value = ""
                N20.style.backgroundcolor = "Buttonface"
            End If
            If Len(N20.Value) = 3 OR InStr(N20.Value, ".") > 0 Then
                N20.Value=Replace(N20.Value,".","")
                Check.Focus
                Check.Select
            End If
    End Sub    
     
    Function IP_Valide(ip)
        Set RegularExpressionObject = New RegExp
        With RegularExpressionObject
            .Pattern = "\b((25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(25[0-5]|2[0-4]\d|1?\d?\d)\b"
            .IgnoreCase = False
            If .Test(ip)= True then
                IP_Valide = True
            end if
        End With
    End Function
     
    Sub CheckIP()
    Dim IP
    Dim Masque
    Dim Passerelle
    Dim DNS1
    Dim DNS2
        IP = N1.Value &"."& N2.Value &"."& N3.Value &"."& N4.Value 
        Masque = N5.Value &"."& N6.Value &"."& N7.Value &"."& N8.Value
        Passerelle = N9.Value &"."& N10.Value &"."& N11.Value &"."& N12.Value
        DNS1 = N13.Value &"."& N14.Value &"."& N15.Value &"."& N16.Value
        DNS2 = N17.Value &"."& N18.Value &"."& N19.Value &"."& N20.Value
     
        If IP_Valide(IP) And IP_Valide(Masque) And IP_Valide(Passerelle) And IP_Valide(DNS1) And IP_Valide(DNS2) Then
            MsgBox "IP : "&IP&vbCr&"Masque sous réseau : "&Masque&vbCr&"Passerelle par défaut : "&Passerelle&vbCr&_
            "DNS1 : "& DNS1&vbCr&"DNS2 : "& DNS2,64,"Les @ IP"
            Else
            MsgBox "Attention ! la saisie des adresses IP ne sont pas valides !",16,"Attention ! la saisie des adresses IP ne sont pas valides !"
        End If
    End Sub
     
    Sub Ip_Publique
        Dim Titre,URL,ie,objFSO,Data,OutPut,objRegex,Match,Matches
        Titre = "Adresse Ip Publique !"
        URL = "http://monip.org"
        Set ie = CreateObject("InternetExplorer.Application")
        Set objFSO = CreateObject("Scripting.FileSystemObject") 
        ie.Navigate (URL) 
        ie.Visible=false
        DO WHILE ie.busy
            Sleep 100
        LOOP
        Data = ie.document.documentElement.innertext 
        ie.Quit 
        Set ie = Nothing
        Set objRegex = new RegExp
        objRegex.Pattern = "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
        objRegex.Global = False
        objRegex.IgnoreCase = True
        Set Matches = objRegex.Execute(Data)
        For Each Match in Matches   
            ip_public.InnerHTML = Match.Value
        Next
    End Sub
     
    Sub Sleep(MSecs)' Fonction pour faire une pause car wscript.sleep ne marche pas dans un HTA 
        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>
    <fieldset>
    <legend>Utiliser l'adresse IP suivante</legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Adresse IP Locale :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN1()" name="N1" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN2()"name="N2"/><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN3()" name="N3"/><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN4()" name="N4" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Masque sous-réseau :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN5()" name="N5" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN6()" name="N6" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN7()" name="N7"/><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN8()" name="N8" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Passerelle par défaut :</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN9()" name="N9" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN10()" name="N10"/><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN11()" name="N11" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN12()" name="N12" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <fieldset>
    <legend>Utiliser l'adresse DNS suivante </legend>
    <table>
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 1 : &nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN13()" name="N13" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN14()" name="N14" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN15()" name="N15" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN16()" name="N16" />
    </div></td>
    </tr>
     
    <tr>
    <td><p style="float:left"><B>Serveur DNS N° 2 :&nbsp;&nbsp;&nbsp;&nbsp;</B></p></td>
    <td><div style="border:solid 1px gray;width:100px;"><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN17()" name="N17" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN18()" name="N18" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN19()" name="N19" /><b>.</b><input type='text' class="IP" maxLength="3" onKeyUp="IPCheckN20()" name="N20" />
    </div></td>
    </tr>
    </table>
    </fieldset>
    <br>
    <center><input type="Submit" class="button" style="cursor:hand;" value="Vérifier les @IP" name="Check"  onClick="CheckIP()" style="font-weight: bold">
    <input type="button" class="button" style="cursor:hand;" value="IP Publique" name="PublicIP"  onClick="Ip_Publique()" style="font-weight: bold"><p> 
    <center><B><font color="blue"><span id="ip_public"></span></font></B></center>
    <body>
    </html>

  6. #6
    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,

    J'ai tenté d'appliquer votre script de vérification d'ip (qui se s'efface automatiquement et met la case en rouge) dans mon interface hta.
    Cependant, celui ci ne semble pas fonctionner, l'aurai je implémenter de la mauvaise façon ?

    Je vous transmet mon code si cela peut vous être utile,

    merci pour votre 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
    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
     
    <html>
    <HTA:APPLICATION 
    SCROLL="no"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="yes"
    SYSMENU="yes"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    SELECTION="no">
    	<head> 
    		<OBJECT ID="objShell" CLASSID="clsid:{72C24DD5-D70A-438B-8A42-98424B88AFB8}" ProgID="WScript.Shell.1"></OBJECT> 
    		<title>NewChangeIP 1.0.0</title>
    		<HTA:APPLICATION  ID="Monprog" CAPTION ="Yes" ICON="laposte.ico" WINDOWSTATE="Normale" SCROLL="No" VERSION="1.0" MAXIMIZEBUTTON="No" >
    		 <link type="text/css" rel="Stylesheet" href="startup.css" />
    		<META HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes" />
    		<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">
     
    		<form name="ValidForm"><br>
    			<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()">
    			</center>
    		</form>
     
    			<META HTTP-EQUIV="MSThemeCompatible" CONTENT="YES">
    			<script language="VBScript" defer=true>
    				window.moveTo 510,200
    				Sub Window_OnLoad
    					CenterWindow 360,315
    				End Sub
     
    				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
     
     
    			dim Ready
    			Ready = 1
     
    			Sub Valider()
     
    				Dim Ips(0)
    				Dim Masques(0)
    				Dim Gateways(0)
    				Dim DNS(2)
     
     
    					Ips(0)=ValidForm.AdrIpStation01.value & "." & ValidForm.AdrIpStation02.value & "." & ValidForm.AdrIpStation03.value & "." & ValidForm.AdrIpStation04.value
    					Masques(0)=ValidForm.AdrSmStation01.value & "." & ValidForm.AdrSmStation02.value & "." & ValidForm.AdrSmStation03.value & "." & ValidForm.AdrSmStation04.value
    					Gateways(0)=ValidForm.AdrRouStation01.value & "." & ValidForm.AdrRouStation02.value & "." & ValidForm.AdrRouStation03.value & "." & ValidForm.AdrRouStation04.value
    					DNS(0)=ValidForm.AdrIpDNS101.value & "." & ValidForm.AdrIpDNS102.value & "." & ValidForm.AdrIpDNS103.value & "." & ValidForm.AdrIpDNS104.value
    					DNS(1)=ValidForm.AdrIpDNS201.value & "." & ValidForm.AdrIpDNS202.value & "." & ValidForm.AdrIpDNS203.value & "." & ValidForm.AdrIpDNS204.value
     
    					objShell.Run "netsh interface ip set address name=""Connexion au réseau local"" static " & Ips(0)& " " & Masques(0) & " " & Gateways(0) & " " & 1, 0, True
    					objShell.Run "netsh interface ip set dns name=""Connexion au réseau local"" static "& DNS(0), 0, True
    					objShell.Run "netsh interface ip add dns name=""Connexion au réseau local"" addr="& DNS(1), 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 Erreur(Var)
    				Alert(Var)
    				Ready=0
    			End sub
     
     
     
     
    	Sub IPCheckAdrIpStation01()
    			On Error Resume Next
    			If AdrIpStation01.Value > 223 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 > 223 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 AdrRouStation01()
    			On Error Resume Next
    			If AdrRouStation01.Value > 223 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 > 223 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 > 223 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>

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

    A tester
    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
    <html>
    <HTA:APPLICATION 
    SCROLL="no"
    SHOWINTASKBAR="yes"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="no"
    CAPTION="yes"
    MAXIMIZEBUTTON="no"
    MINIMIZEBUTTON="yes"
    SYSMENU="yes"
    BORDER="thin"
    BORDERSTYLE="Normal"
    CONTEXTMENU="no"
    Icon = "nslookup.exe"
    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>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()">
    </center>
     
    <script language="VBScript" defer=true>
    window.moveTo 510,200
    Sub Window_OnLoad
    	CenterWindow 360,315
    End Sub
     
    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 Valider()
     
    	Dim Ips
    	Dim Masques
    	Dim Gateways
    	Dim DNS
     
    	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
    	DNS =AdrIpDNS101.value & "." & AdrIpDNS102.value & "." & AdrIpDNS103.value & "." & AdrIpDNS104.value
    	DNS =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 "& DNS, 0, True
    	objShell.Run "netsh interface ip add dns name=""Connexion au réseau local"" addr="& DNS, 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>

  8. #8
    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
    Super, génial merci comme d'habitude ! Impécable !

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

Discussions similaires

  1. interagir en saisie avec un programme externe ?
    Par ctobini dans le forum Langage
    Réponses: 12
    Dernier message: 27/09/2005, 18h02
  2. Problème de saisie avec le "."
    Par Pouf dans le forum ASP
    Réponses: 10
    Dernier message: 18/03/2005, 15h27
  3. Aide à la saisie avec liste déroulante
    Par Oluha dans le forum Général JavaScript
    Réponses: 5
    Dernier message: 01/02/2005, 09h04
  4. [FLASH MX2004] Zone de saisie avec scrollbar
    Par carlito dans le forum Flash
    Réponses: 3
    Dernier message: 29/11/2004, 14h30
  5. boîte de dialogue avec image de fond + texte
    Par Eugénie dans le forum MFC
    Réponses: 13
    Dernier message: 31/08/2004, 13h32

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