FMS Posted May 7, 2014 Posted May 7, 2014 Hello, At first I´m still strugeling whit autoit and hope u can follow me whit mine problem. I´m making a get MAC from IP GUI tool... (when u run it u will cee it ) And found some thing on the internet and put them togheter. The problem i got is that i dont know how to put the GUI inputs in the function and run it. I hope someone can help me or steer me in the right direction ? This is what i got this far.... Thnx in advanced...... cinserly FMS expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> $Form1 = GUICreate("Form1", 305, 163, 192, 124) $IP_from = GUICtrlCreateInput("192.168.9.1", 104, 32, 137, 21) $IP_to = GUICtrlCreateInput("192.168.9.255", 104, 52, 137, 21) $C_MAC = GUICtrlCreateCheckbox("Retrieve MAC", 16, 96, 97, 17) $Group1 = GUICtrlCreateGroup("IP range", 8, 8, 265, 81) $Label1 = GUICtrlCreateLabel("IP range from", 24, 32, 67, 17) $Label2 = GUICtrlCreateLabel("IP range to", 24, 56, 56, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $C_OS = GUICtrlCreateCheckbox("Retrieve OS", 16, 118, 97, 17) $B_Run = GUICtrlCreateButton("Run", 112, 104, 75, 25) $B_Cancel = GUICtrlCreateButton("Cancel", 192, 104, 75, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $B_Cancel Exit Case $B_Run F_Run() #cs (make list visible) (Get IP list from / to) (get iff checked name) (ping from / to ) (get iff checked MAC) (get iff checked OS) #ce EndSwitch WEnd Func F_Run() Local $iI, $iTimer, $hListView GUICreate("Ping IP Name Mac", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlListView_AddColumn($hListView, "Ping", 100) _GUICtrlListView_AddColumn($hListView, "IP", 100) _GUICtrlListView_AddColumn($hListView, "Name", 100) _GUICtrlListView_AddColumn($hListView, "MAC", 100) _GUICtrlListView_SetItemCount($hListView, 5000) Local $aItems[5000][1] For $iI = 0 To UBound($aItems) - 1 $aItems[$iI][0] = "Item " & $iI Next $iTimer = TimerInit() _GUICtrlListView_AddArray($hListView, $aItems) MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($hListView)) Local $aItems[256][4] For $iI = 1 To UBound($aItems) - 1 $aItems[$iI][0] = "Ping " & $iI $aItems[$iI][1] = "IP " & $iI & "-1" $aItems[$iI][2] = "Name" & $iI & "-2" $aItems[$iI][3] = "Mac " & $iI & "-3" Next $iTimer = TimerInit() _GUICtrlListView_AddArray($hListView, $aItems) MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc as finishing touch god created the dutch
dmob Posted May 7, 2014 Posted May 7, 2014 If I overstand you correctly, you could: a) Pass the values as individual parameters to your function: F_Run($IP_from, $IP_to, $C_MAC, $C_OS) then do your magic inside your function: Func F_Run($ipFrom, $ipTo, $cMAC, $cOS) ; your magic code EndFunc pass a single array containing all the parameters to your function.
FMS Posted May 14, 2014 Author Posted May 14, 2014 (edited) Thnx for the function statements. I just got a bit further But now i got a new problem i think..... expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> $Form1 = GUICreate("IP tool by ME", 322, 156, 192, 124) $IP_from_1 = GUICtrlCreateInput("192", 88, 32, 41, 21) $IP_from_2 = GUICtrlCreateInput("168", 136, 32, 41, 21) $IP_from_3 = GUICtrlCreateInput("9", 184, 32, 41, 21) $IP_from_4 = GUICtrlCreateInput("", 232, 32, 41, 21) $IP_to_1 = GUICtrlCreateInput("192", 88, 64, 41, 21) $IP_to_2 = GUICtrlCreateInput("168", 136, 64, 41, 21) $IP_to_3 = GUICtrlCreateInput("9", 184, 64, 41, 21) $IP_to_4 = GUICtrlCreateInput("", 232, 64, 41, 21) $Label1 = GUICtrlCreateLabel("IP range from", 16, 32, 67, 17) $Label2 = GUICtrlCreateLabel("IP range to", 16, 64, 56, 17) $C_MAC = GUICtrlCreateCheckbox("Get MAC", 8, 104, 97, 17) $C_OS = GUICtrlCreateCheckbox("Get OS", 8, 128, 97, 17) $B_RUN = GUICtrlCreateButton("Run", 104, 112, 75, 25) $B_Cancel = GUICtrlCreateButton("Cancel", 192, 112, 75, 25) $Group1 = GUICtrlCreateGroup("IP range", 8, 8, 289, 89) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $B_Cancel Exit Case $B_Run F_Run($IP_from_1,$IP_from_2,$IP_from_3,$IP_from_4,$IP_to_1,$IP_to_2,$IP_to_3,$IP_to_4, $C_MAC, $C_OS) #cs (make list visible) (Get IP list from / to) (get iff checked name) (ping from / to ) (get iff checked MAC) (get iff checked OS) #ce EndSwitch WEnd Func F_Run ($IP_from_1,$IP_from_2,$IP_from_3,$IP_from_4,$IP_to_1,$IP_to_2,$IP_to_3,$IP_to_4, $C_MAC, $C_OS) Local $iI, $iTimer, $hListView GUICreate("Ping IP Name Mac", 400, 300) $hListView = GUICtrlCreateListView("", 2, 2, 394, 268) GUISetState(@SW_SHOW) _GUICtrlListView_AddColumn($hListView, "IP", 100) _GUICtrlListView_AddColumn($hListView, "Ping", 100) _GUICtrlListView_AddColumn($hListView, "Name", 100) _GUICtrlListView_AddColumn($hListView, "MAC", 100) _GUICtrlListView_SetItemCount($hListView, 5000) Local $aItems[256][4] For $iI = 0 To UBound($aItems) - 1 $aItems[$iI][0] = GUICtrlRead($IP_from_1 & "." & $IP_from_2 & "." & $IP_from_3 & "." & $IP_from_4) & $iI $aItems[$iI][1] = "Ping " & $iI $aItems[$iI][2] = "Name" & $iI & "-2" $aItems[$iI][3] = "Mac " & $iI & "-3" Next $iTimer = TimerInit() _GUICtrlListView_AddArray($hListView, $aItems) MsgBox($MB_SYSTEMMODAL, "Information", "Load time: " & TimerDiff($iTimer) / 1000 & " seconds") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc I fixed some things but when i make the new list I only get the first octet of the IP range in the list.... :S second thing i was thinking about : "is the way I'm aproching this the good way?" What i mean is : I'm just counting down till 256 (starting from 0 in some way ) :S Not till the last " IP_TO" octet please some help thnx in advanced (any exaple scripts will be mush apreacheded ) Edited May 16, 2014 by FMS as finishing touch god created the dutch
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