Jump to content

help list, ping, hostname, os, ip


Recommended Posts

Hello everyone, I am writing to you for help that I need, it happens that in the company where I work they asked me to create a client server tool where you can see the ping, computer name, operating system and the ip of the computer in a listview, of all the local network, in this company they also use the Radmin tool to communicate with other offices, the tool must contain the information that I mention and also the possibility of double-clicking any of the information lines and this runs a program that is already installed in The computers in the following path, c.:\inventory\getinfo.exe, I defend myself a lot in autoit but this program is new to me since I do not know programming in the network part and I have no idea how to start.

Edited by benjamindh
Link to comment
Share on other sites

  • Developers

Great, but what exactly is your question?

I assume you have done your research and came up with something....

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

You know what...   Start doing the reading, research etc and ONLY come back when you have a real plan, tried to make a script you can show us and explain exactly what isn't working as this is really crazy!

If you want others to do the work for you that is fine too, but then go to rent-a-coder or something. 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
42 minutes ago, argumentum said:

...well, it is Christmas :D  

I am sure there will be others that will respond to these code-barf requests as that seems to be happening regularly these day, even when the goals are totally unclear. ;) 
This particular member has a track-record....  hence the slowly changing attitude, as I don't handle lazy people well. 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

do the following:

-Lunch Programme

-Click on Server

-Let Some one else Lunch Programme

-Let Them Click on Client

-You Get all Info About them

-Click double click on item

-run C:\inventory\getinfo.exe

Full code:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <GuiListView.au3>
#include <Misc.au3>

; Start First clicking on "1. Server"
; Then start a second instance of the script selecting "2. Client"
MsgBox(0,"",StringLeft(@IPAddress1,11))
Example()


Func Example()
    UDPStartup() ; Start the UDP service.

    ; Register OnAutoItExit to be called when the script is closed.
    OnAutoItExitRegister("OnAutoItExit")

    ; Assign Local variables the loopback IP Address and the Port.
    Local $sIPAddress = "127.0.0.1" ; This IP Address only works for testing on your own computer.
    Local $iPort = 65532 ; Port used for the connection.
    #Region GUI
    Local $sTitle = "UDP Start"
    Local $hGUI = GUICreate($sTitle, 850, 300)
    $List1 = GUICtrlCreateList("", 590, 42, 225, 227)
        Local $idBtnServer = GUICtrlCreateButton("1. Server", 560, 10, 130, 22)
    Local $idBtnClient = GUICtrlCreateButton("2. Client", 700, 10, 130, 22)
 Global $idListview = GUICtrlCreateListView("Computer Name  |Ip Address |Operation System|Ping  ", 10, 10, 380, 150) ;,$LVS_SORTDESCENDING)
    GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
    GUISetState(@SW_SHOW)

    GUISetState(@SW_SHOW, $hGUI)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idBtnServer
                WinSetTitle($sTitle, "", "UDP Server started")
                GUICtrlSetState($idBtnClient, $GUI_HIDE)
                GUICtrlSetState($idBtnServer, $GUI_DISABLE)
                If Not MyUDP_Server($sIPAddress, $iPort) Then ExitLoop
            Case $idBtnClient
                WinSetTitle($sTitle, "", "UDP Client started")
                GUICtrlSetState($idBtnServer, $GUI_HIDE)
                GUICtrlSetState($idBtnClient, $GUI_DISABLE)
                If Not MyUDP_Client($sIPAddress, $iPort) Then ExitLoop
        EndSwitch

        Sleep(10)
    WEnd

    #EndRegion GUI
EndFunc   ;==>Example

Func MyUDP_Server($sIPAddress, $iPort)
    ; Assign a Local variable the socket and bind to the IP Address and Port specified.
    Local $iSocket = UDPBind($sIPAddress, $iPort)

    ; If an error occurred display the error code and return False.
    If @error Then
        ; Someone is probably already binded on this IP Address and Port (script already running?).
        Local $iError = @error
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Server:" & @CRLF & "Could not bind, Error code: " & $iError)
        Return False
    EndIf

    ; Assign a Local variable to store the data received.
    Local $sReceived = ""
    While 1

  Do
if  _GUICtrlListView_GetSelectionMark($idListview) >= 0 Then
   if _IsPressed("01",DllOpen("user32.dll"))Then
   Run("c:\inventory\getinfo.exe")
   EndIf
   ;;;;off
   EndIf

        ; We are waiting for the string "toto" OR "tata" (example script UDPSend): 4 bytes length.
        $sReceived = UDPRecv($iSocket, 255)
    ; Notes: If you don't know how much length will be the data,
    ; use e.g: 2048 for maxlen parameter and call the function until the it returns nothing/error.
Until  $sReceived <> ""
    ; Display the string received.
Local $mid,$inst
Local $array[1] = ['']
For $i = 0 To StringLen($sReceived)
   ;;
   $mid  = StringMid($sReceived,$i,1)
   if $mid <> ',' Then
   $inst &= $mid;
Else
   _ArrayAdd($array,$inst)
   $inst = ""
   EndIf
   ;;
Next
    $idItem2 = GUICtrlCreateListViewItem( $array[1]&"|"&$array[2]&"|"&$array[3]&"|"&$array[4]   ,$idListview)
    ;GUICtrlSetData($idItem2,  $sReceived)
    $sReceived = ""
    WEnd
   ; MsgBox($MB_SYSTEMMODAL, "", "Server:" & @CRLF & "Received: " & $sReceived)

    ; Close the socket.
    UDPCloseSocket($iSocket)
EndFunc   ;==>MyUDP_Server

Func MyUDP_Client($sIPAddress, $iPort)
    ; Assign a Local variable the socket and connect to a listening socket with the IP Address and Port specified.
    Local $iSocket = UDPOpen($sIPAddress, $iPort)
    Local $iError = 0
    ; If an error occurred display the error code and return False.
    If @error Then
        ; The server is probably offline/port is not opened on the server.
        $iError = @error
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Client:" & @CRLF & "Could not connect, Error code: " & $iError)
        Return False
    EndIf
;&","&StringLeft(@IPAddress1,11)&","&@ComputerName
    ; Send the string "toto" converted to binary to the server.
    $ping = Ping(StringLeft(@IPAddress1,11))
    $operation =  @OSVersion
    $ipaddress = StringLeft(@IPAddress1,11)
    $computer_name = @ComputerName
  UDPSend($iSocket, $computer_name &","&$ipaddress&","&$operation&","&$ping&",")
;   UDPSend($iSocket, StringToBinary("toto"))

    ; If an error occurred display the error code and return False.
    If @error Then
        $iError = @error
        MsgBox(BitOR($MB_SYSTEMMODAL, $MB_ICONHAND), "", "Client:" & @CRLF & "Could not send the data, Error code: " & $iError)
        Return False
    EndIf

    ; Close the socket.
    UDPCloseSocket($iSocket)
EndFunc   ;==>MyUDP_Client

Func OnAutoItExit()
    UDPShutdown() ; Close the UDP service.
EndFunc   ;==>OnAutoItExit

 

 

Edited by ad777

iam ِAutoit programmer.

best thing in life is to use your Brain to

Achieve

everything you want.

Link to comment
Share on other sites

  • Developers
1 hour ago, ad777 said:

-Lunch Programme
.....
- Let Some one else Lunch Programme

Bon Appetit. :)  and as expected .... code barfing completed...  now good luck with that in a corporate environment connected of the internet. ;)    

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...