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()"> <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> |
Partager