Bonjour à tous, je viens vous voir car j'ai développé un petit programme en hta

mon problème est le suivant, dans la partie network j'ai un petit problème d'affichage, il m'afficher les différentes cartes réseau grâce à ma requête wmi mais j'ai des postes avec 5 ou 6 cartes réseau et donc j'aimerais à ce moment là que la fenêtre s'agrandisse automatiquement. Qu'elle s'agrandisse à partir d'un certain nombres de carte pour eviter d'utiliser le scroll. J'ai essayer d'appliquer un LIMIT 3 et ensuite de mettre en place un window resize to sur mon bouton onclick() mais sans résultat
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
<html>
<head>
<title>Info Support</title>
<HTA:APPLICATION
  APPLICATIONNAME="Info"
  ID="objCIT"
  VERSION="1"
  BORDER="thin"
  BORDERSTYLE="raised"
  CAPTION="Yes"
  MAXIMIZEBUTTON="no"
  MINIMIZEBUTTON="no"
  ICON="support.ico"
  SCROLL="Yes"
  SINGLEINSTANCE="yes"
  CONTEXTMENU="no"
  NAVIGABLE="yes"
  SELECTION="yes"
  WINDOWSSTATE="normal"/>
 
<!-- AD Browser Style -->		
<style type="text/css">	
 
<!-- Computer Information Tool Style -->		
 
html,body{
    width:100%;
    height:100%;
	margin:0px;
	background-color:#FFFFFF; /*#FFFFFF;*/
	font-family:Arial, Helvetica, sans-serif;
	font-size:14px;
	color:#000000;
}
h1 {
	font-size:24px;
	font-weight:bold;
	color:#FFFFFF;
	background-color:#2886C8;
	text-align:center;
	border-style:solid;
	border-width:thin;
	border-color:#C9E0F1;
	padding:5px;
}
h2 {
	font-size:18px;
	font-weight:bold;
}
h3 {
	font-size:16px;
	font-weight:bold;
}
a {
	color:#2886C8;
	text-decoration: none;
}
img {
	border: none;
	margin: 0px;
}
#Main {
	margin-left:0px;
	margin-right:0px;
}
#DisplayError {
	color:black;
	margin-left:20px;
	margin-right:20px;
}
 
#Info {
	position: absolute; 
	top: 10px; 
	right: 13px;
	margin-bottom: 3px;
}
 
.Button { 
	color: #444444; 
} 
.InfoSectionHeader {
	font-size:20px;
	font-weight:bold;
	background-color:#0000CD;
	color:#FFFFFF;
	text-align:center;
	padding:5px;
	margin-top:0px;
	cursor:pointer;
}
.InfoSection {
	text-align:center;
	margin-bottom:10px;
	background-color:#F0F8FF;
	border-color:#F0F8FF;
	border-style:dotted;
	border-width:1px;
}
.InfoSectionBody {
	padding:10px;
}
.Link {
	text-decoration: underline;
	cursor:pointer;
	color:#2886C8;
}
.HeaderLink {
	text-decoration: underline;
	cursor:pointer;
	color:#FFFFFF;
}
 
.Table {
	/*width:90%;*/
    border: 2px solid;
	border-collapse: collapse;
	border-color: #696969;
}
.Table th {
	border: 1px dotted #787878;
	border-color: #787878;
	color: #FFFFFF;
	font: bold 12pt arial, sans-serif;
	background-color: #595959; /* #787878;*/
	text-align: left;
	padding=3px;
}
.Table td {
	border: 1px dotted #787878;
	border-color: #787878;
	font: bold 10pt arial, sans-serif;
	color: #787878;
	padding=5px;
}
 
#Contact {
	padding:0px;
}
.Table2 {
	/*width:90%;*/
	border-collapse: collapse;
	border-color: #696969;
	/*background-color:#787878;*/
}
.Table2 th {
	border: 1px dotted #111111;
	border-color: #787878;
	color: #FFFFFF;
	font: bold 12pt arial, sans-serif;
	background-color: #595959; /* #787878;*/
	text-align: left;
	padding=0px;
}
.Table2 td img {
	height: 75px;
}
.Table2 td a {
	color: #000000;
	font: bold 12pt arial, sans-serif;
}
.Table2 td a:hover {
	text-decoration:underline;
}
.Table2 td {
	border-color: #787878;
	font: bold 14pt arial, sans-serif;
	color: #787878;
	padding: 10px;
	text-align:center;
	margin-right: 0;
 
}
.black {
	color: #787878;
}
</style>
 
<!-- Computer Information Tool Scripts -->
<script language="VBScript">
 
	OPTION EXPLICIT
	CONST bytesToMB = 1048576
    CONST bytesToGB = 1073741824
    CONST bytesToTB = 1099511627776
    CONST adVarChar = 200
    CONST adDate = 7
	CONST MaxCharacters = 255
	CONST adFldIsNullable = 32
	CONST adInteger = 3
	CONST adBigInt = 20
    CONST blnConfirmKillProcess = TRUE
	CONST ADS_SECURE_AUTHENTICATION = 1
 
    PRIVATE objWMIService
    PRIVATE strComputer
    PRIVATE intProcessTimerID
	PRIVATE blnInitialized
 
	' ***************************************
	' Checks for any commandline arguments
	' Parses and uses first argument (Excepts only one IP or Hostname)
	' ***************************************
	SUB Window_Onload()
		window.offscreenBuffering = True
		DIM arrCommands, timeOut
 
		arrCommands = Split(objCIT.commandLine, "/host:")  'chr(34))
		IF UBound(arrCommands) > 0 THEN
			strComputer = arrCommands(UBound(arrCommands))
		END IF
 
		window.document.Body.Style.Cursor = "wait"
		timeOut= window.setTimeout("GenerateReport", 10)
		timeOut= window.setTimeout("GenerateNetworkInfo", 200)
 
	END SUB
 
	' ***************************************
	' Open Windows explorer to a given path
	' Used when clicking a link in the "Shares" section
	' ***************************************
	SUB OpenUNC(BYVAL strPath)
 
		DIM objShell
 
		SET objShell = CREATEOBJECT("Wscript.Shell")
		strPath = "explorer.exe /e," & strPath
		objShell.Run strPath
 
	END SUB
 
	SUB Network_Onclick()
		DIM timeOut
		window.document.Body.Style.Cursor = "wait"
		timeOut= window.setTimeout("GenerateNetworkInfo", 10)
	END SUB
 
	SUB GenerateNetworkInfo
		if Network.InnerHTML = "" THEN
			Network.InnerHTML = Network_HTML
		END IF
		window.document.Body.Style.Cursor = "default"
	END SUB
 
	' ***************************************
	' Replace special HTML characters
	' ***************************************
	FUNCTION HTMLEncode(strValue)
		HTMLEncode= REPLACE(REPLACE(strValue,"<","&lt;"),">","&gt;")
	END FUNCTION
 
	' ***************************************
	' Convert Bytes to MB,GB or TB as appropriate
	' ***************************************
    FUNCTION ConvertToDiskUnit(BYVAL value) 
        IF (value/bytesToTb) > 1 THEN
            ConvertToDiskUnit = ROUND(value / bytesToTB,1) & " TB"
        ELSEIF (value/bytesToGb) > 1 THEN
            ConvertToDiskUnit = ROUND(value / bytesToGB,1) & " GB"
        ELSE
            ConvertToDiskUnit = ROUND(value / bytesToMB,1) & " MB"
        END IF
    END FUNCTION
 
 
   	' ***************************************
	' Convert date string to a more readable format
	' ***************************************
    FUNCTION FormatDate(BYVAL strValue)
    	DIM strDate
    	IF ISNULL(strValue) OR strValue = "" THEN
    		strDate = ""
    	ELSE
    		strDate = LEFT(strValue,4) & "-" & MID(strValue,5,2) & "-" & MID(strValue,7,2) & " " & _
    				MID(strValue,9,2) & ":" &  MID(strValue,11,2)
    	END IF
    	FormatDate = strDate
    END FUNCTION
 
	' ***************************************
	' Clear existing report data
	' ***************************************
	SUB Reset
		Main.Style.Display = "none"
		Network.Style.Display = "none"
		Network.InnerHTML = ""
		OS.InnerHTML =""
		DisplayError.InnerHTML=""
		blnInitialized = True
	END SUB
 
	' ***************************************
	' Main procedure used to generate report
	' Calls other procedures that generate the HTML for each section
	' ***************************************
	SUB GenerateReport
 
		DIM objNetwork
		SET objNetwork = CREATEOBJECT("wscript.network")
		strComputer =  objNetwork.ComputerName
		Reset()
 
		IF strComputer = "" THEN
			SET objNetwork = CREATEOBJECT("wscript.network")
			strComputer =  objNetwork.ComputerName
		END IF
		SET objWMIService = GETOBJECT("winmgmts:\\" & strComputer & "\root\cimv2")
		CurrentComputer.InnerHTML = strComputer
		Main.Style.Display = ""
 
		OS.InnerHTML = OS_HTML
 
 
		window.document.Body.Style.Cursor = "default"
	END SUB
 
 
 
    ' ***************************************
	' Gets computer system info to be included in the "OS / General" section
	' *************************************** 
    SUB GetComputerSystemInfo(BYRef strobjSMBIOS,BYRef strDNSHostName,ByRef strDomain, _
    						ByRef strManufacturer,ByRef strModel,ByRef strUserName)
    	DIM objItem, colItems, objSMBIOS, colSMBIOS
 
		SET colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
		FOR EACH objItem In colItems
			ON ERROR RESUME NEXT 
			strDNSHostName = HTMLEncode(objItem.DNSHostName)
			strDomain = HTMLEncode(objItem.Domain)
			strManufacturer = HTMLEncode(objItem.Manufacturer)
			strModel = HTMLEncode(objItem.Model)
			strUserName = HTMLEncode(objItem.UserName)
			ON ERROR GOTO 0
			IF strUserName = "" THEN
				strUserName = "{not logged in}"
			END IF
		NEXT
 
		SET colSMBIOS = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure")
		FOR EACH objSMBIOS IN colSMBIOS
			strobjSMBIOS = HTMLEncode(objSMBIOS.SerialNumber)
		NEXT
 
    END SUB
 
    ' ***************************************
	' Returns a HTML report for the "Operating System/General" section
	' ***************************************  
    FUNCTION OS_HTML()
 
    	DIM objItem, colItems
		DIM strHTML
		DIM strobjSMBIOS,strDNSHostName,strDomain,strManufacturer,strModel,strUserName
		GetComputerSystemInfo strobjSMBIOS,strDNSHostName,strDomain,strManufacturer,strModel,strUserName
 
		SET colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
 
		strHTML = "<h3 style=" & CHR(34) & " margin-bottom:0px" & CHR(34) & ">Nom de machine: <span class='black'>" & strDNSHostName & "</span></h3>" & _
				  "<h3 style=" & CHR(34) & " margin-top:0px" & CHR(34) & ">Utilisateur courant: <span class='black'>" & strUserName & "</span></h3>"
 
		FOR EACH objItem In colItems
			DIM strComputerRole, nbJours, nbHeures, nbMinutes
			DIM strCaption,strBuildNumber,strInstallDate,strBootDate
			DIM intServicePackMajor,intServicePackMinor,intTotalVisibleMemorySize
			DIM intFreePhysicalMemory,intTotalVirtualMemorySize,intFreeVirtualMemory
			ON ERROR RESUME NEXT
			strCaption = HTMLEncode(objItem.Caption)
			strBuildNumber = HTMLEncode(objItem.BuildNumber)
			intTotalVisibleMemorySize = objItem.TotalVisibleMemorySize
			intFreePhysicalMemory = objItem.FreePhysicalMemory
			strInstallDate = FormatDate(objItem.InstallDate)
			strBootDate = FormatDate(objItem.LastBootUpTime)
			ON ERROR GOTO 0
 
			nbMinutes = DateDiff("n", strBootDate, now) 
			nbHeures = nbMinutes \ 60
			nbJours = nbHeures \ 24
 
			strHTML = strHTML & "<table class=""Table"">" & _
					 	"<tr>" & _
					 	"<th>Syst&egrave;me d'exploitation:</th><td>" & strCaption & "</td>" & _
					 	"<th>Allum&eacute; depuis:</th><td>"
			if nbHeures > 0 Then
				if nbJours > 0 Then 
					strHTML = strHTML & nbJours & " jour(s), "
				End If
				if nbHeures - nbJours * 24 > 0 Then
					strHTML = strHTML & nbHeures - nbJours * 24 & " heure(s)"
				End If
 
				strHTML = strHTML & " et "
			End if
 
			strHTML = strHTML & nbMinutes - nbHeures * 60 & " minute(s)</td>" & _
					 	"</tr><tr>" & _
					 	"<th>Service Tag:</th><td>" & strobjSMBIOS & "</td>" & _
					 	"<th>Domaine:</th><td>" & strDomain & "</td>" & _
					 	"</tr><tr>" & _
					 	"<th>Constructeur:</th><td>" & strManufacturer & "</td>" & _
					 	"<th>Mod&egrave;le:</th><td>" & strModel & "</td>" & _
						"</tr>" & _
						"</table>"
			EXIT FOR
		NEXT
 
		OS_HTML = strHTML
 
    END FUNCTION
 
 
	' ***************************************
	' Returns a HTML report for the "Network" section
	' ***************************************  
	FUNCTION Network_HTML()
    	DIM objItem, colItems
		DIM objItem2, colItems2
		DIM strHTML
 
		SET colItems = objWMIService.ExecQuery("Select * From Win32_NetworkAdapter WHERE MACAddress is not null")
		strHTML = "<table class=""Table"">" & _
				"<tr>" & _
				"<th>Actif</th>" & _
				"<th>Nom</th>" & _
				"<th>Adresse IPv4</th>" & _
				"<th>Adresse MAC</th>" & _
				"<th>DHCP</th>" & _
				"<th>Serveurs DNS</th>" & _
				"</tr>"
 
		FOR EACH objItem IN colItems
			DIM strEnabled,strName,strMAC,strIndex
			ON ERROR RESUME NEXT
			IF objItem.PhysicalAdapter = True Then
				strEnabled = objItem.NetEnabled
				strName = objItem.Name
				strMAC = objItem.MACAddress
				strIndex = objItem.Index
 
				SET colItems2 = objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration")
				FOR EACH objItem2 in colItems2
					DIM strIP4,strIP6,strDHCP,strDHCPServer,strDNSServer
					ON ERROR RESUME NEXT
 
					IF objItem2.Index = strIndex THEN
						strIP4 = Split(Join(objItem2.IPAddress, ", "), ", ",2)(0)
						strIP6 = Split(Join(objItem2.IPAddress, ", "), ", ",2)(1)
						strDHCP = objItem2.DHCPEnabled
						strDHCPServer = objItem2.DHCPServer
						strDNSServer = Join(objItem2.DNSServerSearchOrder, ", ")
 
						ON ERROR GOTO 0
						strHTML = strHTML & "<tr><td>" & strEnabled & "</td>" & _
											"<td>" & strName & "</td>" & _
											"<td>" & strIP4 & "</td>" & _
											"<td>" & strMAC & "</td>" & _
											"<td>" & strDHCPServer & "</td>" & _
											"<td>" & strDNSServer & "</td>" & _
											"</tr>"
					END IF
				NEXT		
			END IF
		NEXT
 
		strHTML = strHTML & "</table>"
 
		Network_HTML=strHTML
    END FUNCTION	
 
 
 
	Function strClean (strToClean)
		Dim objRegExp, outputStr
		Set objRegExp = New Regexp
 
		objRegExp.IgnoreCase = True
		objRegExp.Global = True
		objRegExp.Pattern = "((?![a-zA-Z0-9]).)+"
		outputStr = objRegExp.Replace(strToClean, "")
 
		objRegExp.Pattern = "([\r\n\-+])"
		outputStr = objRegExp.Replace(outputStr, "")
 
		strClean = outputStr
	End Function
</script>
<!-- Computer Information Tool Scripts -->
<script type="text/javascript">
    window.resizeTo(600,430);
	/* Toggle expand/collapse state for specified section */
	function toggleDisplay(obj) {
		var el = document.getElementById(obj);
		if ( el.style.display != 'none' ) {
			el.style.display = 'none';
		}
		else {
			el.style.display = '';
		}
	}
 
	function openURL(URL)
	{
		var shell = new ActiveXObject("WScript.Shell");
		shell.run(URL);
	}
 
</script>
</head>
 
	<body> <!-- OnLoad="GenerateReport"> -->
 
 
		<div id="Main" style="display:none;">
			<div id="contact" class="InfoSectionBody">
				<table class="Table2">
					<tr>
						<td><img src="logo.png" /></td>
						<td>Helpdesk : <span class="black">0999 70 82 06 999</span><br /><br /><a href=# onClick="javascript:openURL('https://hotmail.com');">SERVICE exemple's</a></td>
					</tr>
				</table>
			</div>
 
			<div id="CurrentComputer" style="display:none"></div>
 
			<div class="InfoSection">
				<div onClick="javascript:toggleDisplay('OS');"  class="InfoSectionHeader">Operating System / General</div>
				<div id="OS" class="InfoSectionBody" ></div>
			</div>
 
			<div class="InfoSection">
				<a href='#Network'><div onClick="javascript:toggleDisplay('Network');VBScript:Network_Onclick();"  class="InfoSectionHeader">Network</div></a>
				<div id="Network" class="InfoSectionBody"></div>
			</div>
 
		</div> <!-- End Main -->
 
		<div id="DisplayError">
		</div> <!-- End DisplayError -->
	</body>
</html>