Sign in to follow this  
Followers 0
Skorn

Help with ping tool

2 posts in this topic

#1 ·  Posted (edited)

Hello, I wanted to make a ping app for my company. We have 2 different networks so I have radio buttons to choose from, which would look like this:

radio1 = ip starts with 10.0.0.

radio2 = ip starts with 20.0.0.

then there is an updown that selects the last octet of the ip. But for some reason it is not updating and the last octet always winds up being 9 or 10 regardless of what I choose in the updown box.

Thanks in advance

ps-the code for the actual pinging was taken from a post on this site, i couldn't find who it was from again to give credit, so thanks whoever you are.

#include <GuiConstants.au3>

GuiCreate("Ping Tool", 300, 300)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)

; selection
GUISetFont (16, 400, 0, "Arial")
GuiCtrlCreateGroup("Choose store:", 30, 20, 180, 100)
$radio1 = GuiCtrlCreateRadio("Store 1", 50, 40, 80)
GuiCtrlSetState(-1, $GUI_CHECKED)
$radio2 = GuiCtrlCreateRadio("Store 2", 50, 80, 120)
GUICtrlCreateGroup ("",-99,-99,1,1);close group

; first 3 octets
$store = GUICtrlCreateLabel("", 60, 200, 100, 30, 0x1000)

; 4th octet selection (width, height)
GUISetFont (16, 400, 0, "Arial")
GuiCtrlCreateLabel("IP Address", 115, 165)
$endip = GuiCtrlCreateInput("1", 180, 200, 75, 30)
GuiCtrlCreateUpDown(-1)
GUICtrlSetLimit(-1,254, 1)

; create ping button
$ping= GUICtrlCreateButton("Ping!", 130, 250, 60, 35)

; GUI MESSAGE LOOP
GuiSetState()

; set default
GUICtrlSetData($store, "10.0.0.")
$startip = "10.0.0."


While 1
   $msg = GUIGetMsg()
   Select
     
      Case $msg = $radio1
             GUICtrlSetData($store, "10.0.0.")
         $startip = "10.0.0."
      Case $msg = $radio2
             GUICtrlSetData($store, "20.0.0.")
         $startip = "20.0.0."
      Case $msg = $ping
         $fullip = $startip & $endip
         $test = $startip & $endip
          msgbox(0,"Updown",$fullip)
         RunWait(@ComSpec & " /C Ping -a -n 1 " & $fullip & "> Find_IP.txt",@MyDocumentsDir, @SW_HIDE)
         $ip = FileRead(@MyDocumentsDir & "\Find_IP.txt", FileGetSize(@MyDocumentsDir & "\Find_IP.txt"))
         FileDelete(@MyDocumentsDir & "\Find_IP.txt")
         MsgBox(0,"Returned Ping String [data]", "" & $ip)
;         MsgBox(0,"" & $strcomputer & " IP:", "" & $ip) 
       
   EndSelect
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Edited by Skorn

Share this post


Link to post
Share on other sites



$fullip = $startip & GUICtrlRead($endip)
         $test = $startip & GUICtrlRead($endip)


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0