Je pose une question pour une fois car je n'arrive pas à trouver pourquoi sa fait sa...
Je m'amusait a refaire un code, mais en changeant un input par un IP.
Voici le code :
► Afficher le texte
Code : Tout sélectionner
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.6.1
Author: Jérome
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
; Include :
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiIPAddress.au3>
#include <GUIListBox.au3>
#Include <GuiListView.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <inet.au3>
#include <WindowsConstants.au3>
;#def variable
Global $i
; Form 1
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 616, 430, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "quitter")
Opt("GUIOnEventMode", 1) ; Event mode
; #################################### onglet 1
$Tab1 = GUICtrlCreateTab(0, 0, 633, 25)
$TabSheet1 = GUICtrlCreateTabItem("List IP")
GUICtrlCreateTabItem("")
GUISetFont(8, 400, 0, "Tahoma")
$IPAddress1 = _GUICtrlIpAddress_Create($Form1, 96, 400, 130, 21)
_GUICtrlIpAddress_Set($IPAddress1, "192.168.120.102")
$IPAddress2 = _GUICtrlIpAddress_Create($Form1, 272, 400, 130, 21)
_GUICtrlIpAddress_Set($IPAddress2, "192.168.120.105")
$Label1 = GUICtrlCreateLabel("De :", 48, 400, 28, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Label2 = GUICtrlCreateLabel("a :", 248, 400, 20, 20)
GUICtrlSetFont(-1, 10, 400, 0, "Tahoma")
$Button1 = GUICtrlCreateButton("Start", 432, 398, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent($Button1, "ActionButton1")
$List1 = GUICtrlCreateListView("", 16, 32, 580, 357)
_GUICtrlListView_AddColumn($List1, "IP", 100)
_GUICtrlListView_AddColumn($List1, "Computer Name", 100)
_GUICtrlListView_AddColumn($List1, "User Actually Connected", 200)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
sleep(1000)
WEnd
Func ActionButton1()
$IPAddress1 = _GUICtrlIpAddress_Get($IPAddress1)
$IPAddress2 = _GUICtrlIpAddress_Get($IPAddress2)
;Ping($IPAddress1,50)
;ConsoleWrite("ping "& $IPAddress1 & @CRLF)
;ConsoleWrite(Ping($IPAddress1, 50) & @CRLF)
Global $avArray[255][3], $j
$j = 0
_GUICtrlListView_DeleteAllItems($List1)
TCPStartup()
If @error Then Return GUICtrlCreateListViewItem('Aucun résultats',$List1)
For $i = $IPAddress1 To $IPAddress2
MsgBox("","",$i & @CRLF & $IPAddress1 & @CRLF & $IPAddress2)
; ;GUICtrlSetData($Label4, "Ckecking : $i)
; If Ping($i, 50) > 0 Then
; $IpList = $i
; $sResult = _TCPIpToName($IpList, 0)
; $j = $j + 1
; If $sResult = "" Then
; $sResult = "No Name"
; EndIf
; $string = "local"
; If StringRight($sResult, 5) = $string Then
; $sResult = stringTrimRight($sResult, 5)
; EndIf
; If $sResult = "No Name" Then
; $user = "Nobody"
; Else
; $objWMIService = ObjGet("winmgmts:" _
; & "{impersonationLevel=impersonate}!\\" _
; & $IpList & "\root\cimv2")
; If @error Then
; $user = "Nobody"
; Else
; $colComputers = $objWMIService.ExecQuery _
; ("Select * from Win32_ComputerSystem")
; For $objComputer in $colComputers
; $user = $objComputer.UserName
; Next
; EndIf
; EndIf
; GUICtrlCreateListViewItem($IpList & "|" & $sResult & "|" & $user, $List1)
; $avArray[$j][0] = $IpList
; $avArray[$j][1] = $sResult
; $avArray[$j][2] = $user
; EndIf
Next
EndFunc ;==>ActionButton1
Func quitter()
Exit
EndFunc ;==>quitterJe n'arrive pas à savoir pourquoi quand je ré-affecte ma variable $IPAddress1 sur $i, elle change ...
Du coup impossible de continuer mon script et donc de faire le ping...
Si quelqu'un à une idée du pourquoi du comment...
Jérôme



