TomDuDolan Posted June 26, 2011 Posted June 26, 2011 Hello, just wanted to post the first script I made on autoit. It's a common pinger with 6 IP/URL input boxes, the results are shown at the side of the button. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Simple Ping - http://scriptr.uk.to", 295, 178, 192, 114) GUISetBkColor(0x00FFFF) ;Input IPs $IP1 = GUICtrlCreateInput("scriptr.uk.to", 0, 36, 121, 21) $IP2 = GUICtrlCreateInput("IP2", 0, 60, 121, 21) $IP3 = GUICtrlCreateInput("IP3", 0, 84, 121, 21) $IP4 = GUICtrlCreateInput("IP4", 0, 108, 121, 21) $IP5 = GUICtrlCreateInput("IP5", 0, 132, 121, 21) $IP6 = GUICtrlCreateInput("IP6", 0, 156, 121, 21) ;End of Input $Label1 = GUICtrlCreateLabel("Scriptr's Simple Ping", 0, 8, 99, 17) $ipbtn1 = GUICtrlCreateButton("Ping IP", 124, 36, 75, 21) $ipbtn2 = GUICtrlCreateButton("Ping IP", 124, 60, 75, 21) $ipbtn3 = GUICtrlCreateButton("Ping IP", 124, 84, 75, 21) $ipbtn4 = GUICtrlCreateButton("Ping IP", 124, 108, 75, 21) $ipbtn5 = GUICtrlCreateButton("Ping IP", 124, 132, 75, 21) $ipbtn6 = GUICtrlCreateButton("Ping IP", 124, 156, 75, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ipbtn1 $ip1ping = Ping(GUICtrlRead($IP1)) GUICtrlCreateLabel("Result: " & $ip1ping & " MS", 200, 36, 96, 20) Case $ipbtn2 $ip2ping = Ping(GUICtrlRead($IP2)) $Label3 = GUICtrlCreateLabel("Result: " & $ip2ping &" MS", 200, 60, 80, 17) Case $ipbtn3 $ip3ping = Ping(GUICtrlRead($IP3)) $Label4 = GUICtrlCreateLabel("Result: " & $ip3ping & " MS", 200, 84, 80, 17) Case $ipbtn4 $ip4ping = Ping(GUICtrlRead($IP4)) $Label5 = GUICtrlCreateLabel("Result: " & $ip4ping & " MS", 200, 108, 80, 17) Case $ipbtn5 $ip5ping = Ping(GUICtrlRead($IP5)) $Label6 = GUICtrlCreateLabel("Result: " & $ip5ping & " MS", 200, 132, 80, 17) Case $ipbtn6 $ip6ping = Ping(GUICtrlRead($IP6)) $Label7 = GUICtrlCreateLabel("Result: " & $ip6ping & " MS", 200, 156, 80, 17) EndSwitch WEnd My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.
smashly Posted June 26, 2011 Posted June 26, 2011 Hi, nice first effort, thank you for sharing and keep up the good work. Just one suggestion create the labels then use GUICtrlSetData() to update the labels. As it is every time you click a ping button your creating a new label.expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Simple Ping - http://scriptr.uk.to", 295, 178, 192, 114) GUISetBkColor(0x00FFFF) ;Input IPs $IP1 = GUICtrlCreateInput("scriptr.uk.to", 0, 36, 121, 21) $IP2 = GUICtrlCreateInput("IP2", 0, 60, 121, 21) $IP3 = GUICtrlCreateInput("IP3", 0, 84, 121, 21) $IP4 = GUICtrlCreateInput("IP4", 0, 108, 121, 21) $IP5 = GUICtrlCreateInput("IP5", 0, 132, 121, 21) $IP6 = GUICtrlCreateInput("IP6", 0, 156, 121, 21) ;End of Input $Label1 = GUICtrlCreateLabel("Scriptr's Simple Ping", 0, 8, 99, 17) $ipbtn1 = GUICtrlCreateButton("Ping IP", 124, 36, 75, 21) $ipbtn2 = GUICtrlCreateButton("Ping IP", 124, 60, 75, 21) $ipbtn3 = GUICtrlCreateButton("Ping IP", 124, 84, 75, 21) $ipbtn4 = GUICtrlCreateButton("Ping IP", 124, 108, 75, 21) $ipbtn5 = GUICtrlCreateButton("Ping IP", 124, 132, 75, 21) $ipbtn6 = GUICtrlCreateButton("Ping IP", 124, 156, 75, 21) ;create the labels and set them when ping request is sent. $Label2 = GUICtrlCreateLabel("", 200, 36, 96, 20) $Label3 = GUICtrlCreateLabel("", 200, 60, 80, 17) $Label4 = GUICtrlCreateLabel("", 200, 84, 80, 17) $Label5 = GUICtrlCreateLabel("", 200, 108, 80, 17) $Label6 = GUICtrlCreateLabel("", 200, 132, 80, 17) $Label7 = GUICtrlCreateLabel("", 200, 156, 80, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ipbtn1 $ip1ping = Ping(GUICtrlRead($IP1)) GUICtrlSetData($Label2, "Result: " & $ip1ping & " MS") Case $ipbtn2 $ip2ping = Ping(GUICtrlRead($IP2)) GUICtrlSetData($Label3, "Result: " & $ip2ping &" MS") Case $ipbtn3 $ip3ping = Ping(GUICtrlRead($IP3)) GUICtrlSetData($Label4, "Result: " & $ip3ping & " MS") Case $ipbtn4 $ip4ping = Ping(GUICtrlRead($IP4)) GUICtrlSetData($Label5, "Result: " & $ip4ping & " MS") Case $ipbtn5 $ip5ping = Ping(GUICtrlRead($IP5)) GUICtrlSetData($Label6, "Result: " & $ip5ping & " MS") Case $ipbtn6 $ip6ping = Ping(GUICtrlRead($IP6)) GUICtrlSetData($Label7, "Result: " & $ip6ping & " MS") EndSwitch WEnd Cheers.
TomDuDolan Posted June 26, 2011 Author Posted June 26, 2011 Hi, nice first effort, thank you for sharing and keep up the good work. Just one suggestion create the labels then use GUICtrlSetData() to update the labels. As it is every time you click a ping button your creating a new label.expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Simple Ping - http://scriptr.uk.to", 295, 178, 192, 114) GUISetBkColor(0x00FFFF) ;Input IPs $IP1 = GUICtrlCreateInput("scriptr.uk.to", 0, 36, 121, 21) $IP2 = GUICtrlCreateInput("IP2", 0, 60, 121, 21) $IP3 = GUICtrlCreateInput("IP3", 0, 84, 121, 21) $IP4 = GUICtrlCreateInput("IP4", 0, 108, 121, 21) $IP5 = GUICtrlCreateInput("IP5", 0, 132, 121, 21) $IP6 = GUICtrlCreateInput("IP6", 0, 156, 121, 21) ;End of Input $Label1 = GUICtrlCreateLabel("Scriptr's Simple Ping", 0, 8, 99, 17) $ipbtn1 = GUICtrlCreateButton("Ping IP", 124, 36, 75, 21) $ipbtn2 = GUICtrlCreateButton("Ping IP", 124, 60, 75, 21) $ipbtn3 = GUICtrlCreateButton("Ping IP", 124, 84, 75, 21) $ipbtn4 = GUICtrlCreateButton("Ping IP", 124, 108, 75, 21) $ipbtn5 = GUICtrlCreateButton("Ping IP", 124, 132, 75, 21) $ipbtn6 = GUICtrlCreateButton("Ping IP", 124, 156, 75, 21) ;create the labels and set them when ping request is sent. $Label2 = GUICtrlCreateLabel("", 200, 36, 96, 20) $Label3 = GUICtrlCreateLabel("", 200, 60, 80, 17) $Label4 = GUICtrlCreateLabel("", 200, 84, 80, 17) $Label5 = GUICtrlCreateLabel("", 200, 108, 80, 17) $Label6 = GUICtrlCreateLabel("", 200, 132, 80, 17) $Label7 = GUICtrlCreateLabel("", 200, 156, 80, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ipbtn1 $ip1ping = Ping(GUICtrlRead($IP1)) GUICtrlSetData($Label2, "Result: " & $ip1ping & " MS") Case $ipbtn2 $ip2ping = Ping(GUICtrlRead($IP2)) GUICtrlSetData($Label3, "Result: " & $ip2ping &" MS") Case $ipbtn3 $ip3ping = Ping(GUICtrlRead($IP3)) GUICtrlSetData($Label4, "Result: " & $ip3ping & " MS") Case $ipbtn4 $ip4ping = Ping(GUICtrlRead($IP4)) GUICtrlSetData($Label5, "Result: " & $ip4ping & " MS") Case $ipbtn5 $ip5ping = Ping(GUICtrlRead($IP5)) GUICtrlSetData($Label6, "Result: " & $ip5ping & " MS") Case $ipbtn6 $ip6ping = Ping(GUICtrlRead($IP6)) GUICtrlSetData($Label7, "Result: " & $ip6ping & " MS") EndSwitch WEnd Cheers. Will give it a try, thanks! My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.
jaberwacky Posted June 26, 2011 Posted June 26, 2011 Do you script in any other languages? Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
TomDuDolan Posted June 27, 2011 Author Posted June 27, 2011 Do you script in any other languages?No I don't, why you ask?I did script in PAWNO for a while, but I wouldn't really class that as scripting. My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.
jaberwacky Posted June 27, 2011 Posted June 27, 2011 Just seems like you have experience scripting. I think you'll go far. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum?
TomDuDolan Posted June 27, 2011 Author Posted June 27, 2011 Just seems like you have experience scripting. I think you'll go far.Nah, I've been reading, but thanks anyway.That script is pretty old now, I got my radio is examples, should check that out. -Tom. My ickle pieces of software :3Radio Scriptr //Almost completeSimple IP/URL pinger, my first program. //CompletedSimple Downloader // Working - basic stateOn-GoingRadio Scriptr - Radio Server.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now