j'ai un problème avec mon HTA je suis incapable de faire fonctionner mon vbs.. Le script roule très bien tout seul mais un coup dans le HTA ca me donne un erreur sur la ligne 41 soit = Function Ping(strComputer)
je ne trouve pas la solution pouvez vous m'aider ?
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 <html> <head> <title>Ping Utility</title> <hta:application id="Accespointtest" applicationname="acces point link test" border="thin" caption="yes" contextmenu="no" maximizebutton="no" navigable="no" scroll="no" selection="yes" showintaskbar="yes" singleinstance="yes" sysmenu="yes" windowstate="normal"> </head> body { background-color:#173b71; color:black; font-family:arial; font-size:12pt; border:0px; padding:0px; margin:0px; } div{ background-color:#173b71; color:white; font-family:tahoma; font-size:8pt; } div.msg { background-color:#a1c6eb; border:3px double white; border-style:thin; color:black; font-family:tahoma; font-size:8.5pt; font-weight:bold; position:relative; } div.title{ background-color:#173b71; color:white; font-family:san-sarif; font-size:10pt; font-weight:bold; } <script language="VBScript"> Sub Window_Onload window.resizeTo 200,150 End Sub Sub pingfromlist() strList = "c:\list.txt" strLog = "c:\log.txt" Set objfso = CreateObject("scripting.filesystemobject") Set objlist = objfso.OpenTextFile(strList,1) Set objlog = objfso.CreateTextFile(strLog,True) Do Until objlist.AtEndOfStream strComputer = objlist.ReadLine objlog.WriteLine Ping(strComputer) Loop Function Ping(strComputer) Set objShell = CreateObject("WScript.Shell") Set objScriptExec = objShell.Exec( _ "ping -n 2 " & strComputer) strPingResults = LCase(objScriptExec.StdOut.ReadAll) If InStr(strPingResults, "ms") Then If InStr(strPingResults, "la" ) Then Ping = "did not respond to ping." Else Ping = strComputer & " responded to ping." End If Else Ping = strComputer & " did not respond to ping." End If End Function End Sub </script> <body onkeypress="DoCheckEnterKey"> <div class="title" style="position:absolute; left:45px; top:5px;">execute a ping test on all access point</div> <div style="position:absolute; left:5px; top:40px; width:85px; height:35px;"><b>check logfile in c:</b></div> <input class="action_button" type="button" value="Ping" name="PingButton" onClick="pingfromlist" tabindex="2" style="position:absolute;left:225px; top:45px;"> </body> </html>
Partager