Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #NoTrayIcon
- #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
- #AutoIt3Wrapper_icon=icono.ico
- #AutoIt3Wrapper_outfile=HostSearch 1.0.exe
- #AutoIt3Wrapper_Compression=4
- #AutoIt3Wrapper_UseX64=n
- #AutoIt3Wrapper_Res_Comment=Creado por XPyro
- #AutoIt3Wrapper_Res_Description=Script para buscar PCs conectadas en su red local
- #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
- #AutoIt3Wrapper_Res_LegalCopyright=XPYRO SOFT
- #AutoIt3Wrapper_Res_Language=2058
- #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
- #include <ButtonConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <ListViewConstants.au3>
- #include <StaticConstants.au3>
- #include <WindowsConstants.au3>
- #Include <GuiListView.au3>
- #include <iNet.au3>
- $Form1 = GUICreate("HostSearch 1.0", 390, 361, -1, -1)
- $Button1 = GUICtrlCreateButton("Buscar", 5, 8, 75, 25, $WS_GROUP)
- $Button2 = GUICtrlCreateButton("Guardar", 85, 8, 75, 25, $WS_GROUP)
- GUICtrlCreateLabel("De:", 240, 15, 20, 17)
- $Input1 = GUICtrlCreateInput("1", 260, 9, 35, 22)
- GUICtrlCreateLabel("Hasta:", 310, 15, 30, 17)
- $Input2 = GUICtrlCreateInput("300", 350, 9, 35, 22)
- $ListView1 = _GUICtrlListView_Create($Form1, "", 5, 40, 380, 286)
- _GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FLATSB, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
- _GUICtrlListView_InsertColumn($ListView1, 0, "IP", 120)
- _GUICtrlListView_InsertColumn($ListView1, 1, "Nombre local", 120)
- _GUICtrlListView_InsertColumn($ListView1, 2, "Tiempo en responder", 120)
- $Label1 = GUICtrlCreateLabel("Listo para comenzar", 8, 336, 182, 17)
- GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
- GUICtrlSetColor(-1, 0x008000)
- $Label2 = GUICtrlCreateLabel("Acerca de", 335, 336, 53, 17)
- GUICtrlSetFont(-1, 8, 400, 4, "MS Sans Serif")
- GUICtrlSetColor(-1, 0x0000FF)
- GUICtrlSetCursor (-1, 0)
- GUISetState(@SW_SHOW)
- GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
- While 1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $Button1
- $Msgc = MsgBox(8228,"Comenzar","¿Comenzar búsqueda?")
- If $Msgc = 6 Then
- _GUICtrlListView_DeleteAllItems($ListView1)
- GUICtrlSetData($Button1, "Detener")
- GUICtrlSetState($Button2, $GUI_DISABLE)
- GUICtrlSetState($Label2, $GUI_DISABLE)
- $Cadena = StringSplit(@IPAddress1, ".")
- TCPStartup()
- For $i = GUICtrlRead($Input1) To GUICtrlRead($Input2)
- $nMsg = GUIGetMsg()
- If $nMsg = $Button1 Then
- $Msgd = MsgBox(8244,"Detener","¿Desea detener la busqueda?")
- If $Msgd = 6 Then ExitLoop
- EndIf
- $IP = $Cadena[1] & "." & $Cadena[2] & "." & $Cadena[3] & "." & $i
- GUICtrlSetData($Label1, "Buscando en: " & $IP)
- $aping = Ping($IP)
- $aResult = _TCPIpToName($IP)
- If Not @error Then
- $hItem = _GUICtrlListView_AddItem($ListView1, $IP)
- _GUICtrlListView_AddSubItem($ListView1, $hItem, $aResult, 1)
- _GUICtrlListView_AddSubItem($ListView1, $hItem, $aping & " Milisegundos", 2)
- EndIf
- If $nMsg = $Button1 Then
- $Msgd = MsgBox(8244,"Detener","¿Desea detener la busqueda?")
- If $Msgd = 6 Then ExitLoop
- EndIf
- Next
- TCPShutdown()
- GUICtrlSetData($Label1, "Terminado, encontrados " & _GUICtrlListView_GetItemCount($ListView1))
- GUICtrlSetData($Button1, "Buscar")
- GUICtrlSetState($Button2, $GUI_ENABLE)
- GUICtrlSetState($Label2, $GUI_ENABLE)
- MsgBox(8256,"Listo", "Terminado, encontrados " & _GUICtrlListView_GetItemCount($ListView1))
- EndIf
- Case $Button2
- $Saveh = FileSaveDialog("Guardar IPs", "", "Archivo de texto (*.txt)", 18, "Host-" & @MDAY & "-" & @MON & "-" & @YEAR & ".txt", $Form1)
- $Saveho = FileOpen($Saveh, 10)
- For $fw = 0 to _GUICtrlListView_GetItemCount($ListView1)
- FileWrite($Saveho, _GUICtrlListView_GetItemText($ListView1, $fw) & @CRLF & _GUICtrlListView_GetItemText($ListView1, $fw, 1) & @CRLF & _GUICtrlListView_GetItemText($ListView1, $fw, 2) & @CRLF & @CRLF)
- Next
- FileClose($Saveho)
- Case $Label2
- _Acercade()
- EndSwitch
- WEnd
- Func _Acercade() ;Función acerca de-------------------------------------------------
- GUISetState(@SW_DISABLE, $Form1)
- Local $AcForm = GUICreate('Acerca de', 329, 296, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE), $Form1)
- GUICtrlCreateIcon(@ScriptFullPath, 99, 99, 10, 128, 128, BitOR($SS_NOTIFY, $WS_GROUP))
- GUICtrlCreateLabel('HostSearch 1.0.0.0', 0, 145, 329, 33, $SS_CENTER)
- GUICtrlSetFont(-1, 18, 800, 0, 'Verdana')
- GUICtrlCreateLabel('Script para buscar PCs conectadas en su red local.', 0, 180, 329, 17, $SS_CENTER)
- GUICtrlCreateLabel('© 2008 - 2011 XPYRO SOFT', 0, 200, 329, 17, $SS_CENTER)
- Local $Link = GUICtrlCreateLabel('http://softx.comxa.com/', 0, 230, 329, 17, $SS_CENTER)
- GUICtrlSetColor(-1, 0x0000FF)
- GUICtrlSetCursor(-1, 0)
- Local $2Button1 = GUICtrlCreateButton('Aceptar', 77, 255, 175, 25)
- GUISetState(@SW_SHOW, $AcForm)
- Do
- Local $GMsg = GUIGetMsg()
- If $GMsg = $Link Then ShellExecute("http://softx.comxa.com/")
- Sleep(10)
- Until $GMsg = $GUI_EVENT_CLOSE Or $GMsg = $2Button1
- GUISetState(@SW_ENABLE, $Form1)
- GUIDelete($AcForm)
- EndFunc ;---------------------------------------------------------------------------
- Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
- #forceref $hWnd, $iMsg, $iwParam
- Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo
- $hWndListView = $ListView1
- If Not IsHWnd($ListView1) Then $hWndListView = GUICtrlGetHandle($ListView1)
- $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
- $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
- $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
- $iCode = DllStructGetData($tNMHDR, "Code")
- Switch $hWndFrom
- Case $hWndListView
- Switch $iCode
- Case $NM_DBLCLK
- $Nitems = _GUICtrlListView_GetItemCount($ListView1)
- If $Nitems <> "" Then
- $ni = 0
- Do
- $Ires = _GUICtrlListView_GetItemSelected($ListView1, $ni)
- $ni = $ni + 1
- Until $Ires = True
- EndIf
- ShellExecute("\\" & _GUICtrlListView_GetItemText($ListView1, $ni - 1))
- EndSwitch
- EndSwitch
- Return $GUI_RUNDEFMSG
- EndFunc ;==>WM_NOTIFY
- ;http://softx.comxa.com/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement