CH0VI3 Posted April 1, 2011 Share Posted April 1, 2011 Good Day All Good People, This will be my first ever posting on any forum of any kind, so please bare with me. I am a complete newb at coding and have started learing and using AutoIT and Koda. I am sorry if this was posted before, I have looked through the postings and did not find anything of this kind.If someone can help me with the following; I need to select something from the dropdown list and then be able to click the button to preform the task at hand.And the second thing is when you type a IP address in the given box, and click the button next to it, it should preform a ping test on the "typed in ip". expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=beta #AutoIt3Wrapper_Icon=..\..\..\..\..\Back Up\Archivers\logger.ico #AutoIt3Wrapper_Outfile=Servers.exe #AutoIt3Wrapper_Res_Description=Server Checks #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_LegalCopyright=CH0V!3 #AutoIt3Wrapper_Res_Language=1033 #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <WindowsConstants.au3> #include <Process.au3> $CCTV = GUICreate("RSA CCTV SERVERS", 560, 327, 200, 113, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $JNB = GUICtrlCreateButton("JNB - A", 0, 8, 65, 25) GUICtrlSetCursor(-1, 0) $CT = GUICtrlCreateButton("CT - A", 70, 8, 65, 25) GUICtrlSetCursor(-1, 0) $DBN = GUICtrlCreateButton("DBN - A", 140, 8, 65, 25) GUICtrlSetCursor(-1, 0) $PE = GUICtrlCreateButton("PE - A", 210, 8, 65, 25) GUICtrlSetCursor(-1, 0) $EL = GUICtrlCreateButton("EL - A", 280, 8, 65, 25) GUICtrlSetCursor(-1, 0) $UT = GUICtrlCreateButton("UT - A", 350, 8, 65, 25) GUICtrlSetCursor(-1, 0) $BFT = GUICtrlCreateButton("BFT - A", 420, 8, 65, 25) GUICtrlSetCursor(-1, 0) $CORP = GUICtrlCreateButton("CORP - A", 490, 8, 65, 25) GUICtrlSetCursor(-1, 0) $JNBARC = GUICtrlCreateCombo("JNBARC", 0, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45") $CTARC = GUICtrlCreateCombo("CTARC", 70, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35") $DBNARC = GUICtrlCreateCombo("DBNARC", 140, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 ") $PEARC = GUICtrlCreateCombo("PEARC", 210, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15") $ELARC = GUICtrlCreateCombo("ELARC", 280, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15") $UTARC = GUICtrlCreateCombo("UTARC", 350, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15") $BFTARC = GUICtrlCreateCombo("BFTARC", 420, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15") $CORPARC = GUICtrlCreateCombo("CORPARC", 490, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15") $IPAddress1 = _GUICtrlIpAddress_Create($CCTV, 0, 279, 130, 25) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $JNB1 = GUICtrlCreateButton("OK", 0, 80, 65, 17) GUICtrlSetCursor(-1, 0) $CT1 = GUICtrlCreateButton("OK", 70, 80, 65, 17) GUICtrlSetCursor(-1, 0) $DBN1 = GUICtrlCreateButton("OK", 140, 80, 65, 17) GUICtrlSetCursor(-1, 0) $PE1 = GUICtrlCreateButton("OK", 210, 80, 65, 17) GUICtrlSetCursor(-1, 0) $EL1 = GUICtrlCreateButton("OK", 280, 80, 65, 17) GUICtrlSetCursor(-1, 0) $UT1 = GUICtrlCreateButton("OK", 350, 80, 65, 17) GUICtrlSetCursor(-1, 0) $BFT1 = GUICtrlCreateButton("OK", 420, 80, 65, 17) GUICtrlSetCursor(-1, 0) $CORP1 = GUICtrlCreateButton("OK", 490, 80, 65, 17) GUICtrlSetCursor(-1, 0) $PINGB = GUICtrlCreateButton("GO", 135, 279, 35, 25) GUICtrlSetCursor(-1, 0) $JNBRAID = GUICtrlCreateButton("JNB - R", 0, 120, 65, 25) GUICtrlSetCursor(-1, 0) $CTRAID = GUICtrlCreateButton("CT - R", 70, 120, 65, 25) GUICtrlSetCursor(-1, 0) $DBNRAID = GUICtrlCreateButton("DBN - R", 140, 120, 65, 25) GUICtrlSetCursor(-1, 0) $PERAID = GUICtrlCreateButton("PE - R", 210, 120, 65, 25) GUICtrlSetCursor(-1, 0) $ELRAID = GUICtrlCreateButton("EL - R", 280, 120, 65, 25) GUICtrlSetCursor(-1, 0) $UTRAID = GUICtrlCreateButton("UT - R", 350, 120, 65, 25) GUICtrlSetCursor(-1, 0) $BFTRAID = GUICtrlCreateButton("BFT - R", 420, 120, 65, 25) GUICtrlSetCursor(-1, 0) $CORPRAID = GUICtrlCreateButton("CORP - R", 490, 120, 65, 25) GUICtrlSetCursor(-1, 0) $CONFIG = GUICtrlCreateButton("CONFIG", 184, 280, 75, 25) GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"') Case $CT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA.vbs"') Case $DBN RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA.vbs"') Case $PE RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA.vbs"') Case $EL RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL.vbs"') Case $UT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA.vbs"') Case $BFT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT.vbs"') Case $CORP RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC.vbs"') Case $JNBRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA RAIDS.vbs"') Case $CTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA RAIDS.vbs"') Case $DBNRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA RAIDS.vbs"') Case $PERAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA RAIDS.vbs"') Case $ELRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL RAIDS.vbs"') Case $UTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA RAIDS.vbs"') Case $BFTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT RAIDS.vbs"') Case $CORPRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC RAIDS.vbs"') Case $PINGB RunWait(@ComSpec & '') Case $CONFIG Run("C:\SVR\Programe.exe") EndSwitch WEnd In advance thank for the efforts. Link to comment Share on other sites More sharing options...
UEZ Posted April 1, 2011 Share Posted April 1, 2011 (edited) You can use _GUICtrlComboBox_GetEditText() to obtain the selection from the combobox.E.g.$sel_JNBARC = GUICtrlComboBox_GetEditText($JNBARC)For ping you can use something like this:Case $PINGB $ip = _GUICtrlIpAddress_Get($IPAddress1) $ping = Ping($ip) If $ping Then MsgBox(0, "Information", $ip & " is online") Else MsgBox(0, "Information", $ip & " is not pingable") EndIfBr,UEZ Edited April 1, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
hannes08 Posted April 1, 2011 Share Posted April 1, 2011 expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <WindowsConstants.au3> #include <Process.au3> $s_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15" $s_data25 = $s_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 " $s_data35 = $s_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35" $s_data45 = $s_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45" $CCTV = GUICreate("RSA CCTV SERVERS", 560, 327, 200, 113, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $JNB = GUICtrlCreateButton("JNB - A", 0, 8, 65, 25) $CT = GUICtrlCreateButton("CT - A", 70, 8, 65, 25) $DBN = GUICtrlCreateButton("DBN - A", 140, 8, 65, 25) $PE = GUICtrlCreateButton("PE - A", 210, 8, 65, 25) $EL = GUICtrlCreateButton("EL - A", 280, 8, 65, 25) $UT = GUICtrlCreateButton("UT - A", 350, 8, 65, 25) $BFT = GUICtrlCreateButton("BFT - A", 420, 8, 65, 25) $CORP = GUICtrlCreateButton("CORP - A", 490, 8, 65, 25) $JNBARC = GUICtrlCreateCombo("JNBARC", 0, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data45) $CTARC = GUICtrlCreateCombo("CTARC", 70, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data35) $DBNARC = GUICtrlCreateCombo("DBNARC", 140, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data25) $PEARC = GUICtrlCreateCombo("PEARC", 210, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $ELARC = GUICtrlCreateCombo("ELARC", 280, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $UTARC = GUICtrlCreateCombo("UTARC", 350, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $BFTARC = GUICtrlCreateCombo("BFTARC", 420, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $CORPARC = GUICtrlCreateCombo("CORPARC", 490, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $IPAddress1 = _GUICtrlIpAddress_Create($CCTV, 0, 279, 130, 25) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $JNB1 = GUICtrlCreateButton("OK", 0, 80, 65, 17) $CT1 = GUICtrlCreateButton("OK", 70, 80, 65, 17) $DBN1 = GUICtrlCreateButton("OK", 140, 80, 65, 17) $PE1 = GUICtrlCreateButton("OK", 210, 80, 65, 17) $EL1 = GUICtrlCreateButton("OK", 280, 80, 65, 17) $UT1 = GUICtrlCreateButton("OK", 350, 80, 65, 17) $BFT1 = GUICtrlCreateButton("OK", 420, 80, 65, 17) $CORP1 = GUICtrlCreateButton("OK", 490, 80, 65, 17) $PINGB = GUICtrlCreateButton("GO", 135, 279, 35, 25) $JNBRAID = GUICtrlCreateButton("JNB - R", 0, 120, 65, 25) $CTRAID = GUICtrlCreateButton("CT - R", 70, 120, 65, 25) $DBNRAID = GUICtrlCreateButton("DBN - R", 140, 120, 65, 25) $PERAID = GUICtrlCreateButton("PE - R", 210, 120, 65, 25) $ELRAID = GUICtrlCreateButton("EL - R", 280, 120, 65, 25) $UTRAID = GUICtrlCreateButton("UT - R", 350, 120, 65, 25) $BFTRAID = GUICtrlCreateButton("BFT - R", 420, 120, 65, 25) $CORPRAID = GUICtrlCreateButton("CORP - R", 490, 120, 65, 25) $CONFIG = GUICtrlCreateButton("CONFIG", 184, 280, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"') Case $CT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA.vbs"') Case $DBN RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA.vbs"') Case $PE RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA.vbs"') Case $EL RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL.vbs"') Case $UT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA.vbs"') Case $BFT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT.vbs"') Case $CORP RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC.vbs"') Case $JNBRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA RAIDS.vbs"') Case $CTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA RAIDS.vbs"') Case $DBNRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA RAIDS.vbs"') Case $PERAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA RAIDS.vbs"') Case $ELRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL RAIDS.vbs"') Case $UTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA RAIDS.vbs"') Case $BFTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT RAIDS.vbs"') Case $CORPRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC RAIDS.vbs"') Case $PINGB $s_ip = _GUICtrlIpAddress_Get($IPAddress1) If Ping($s_ip) > 0 Then MsgBox(0, "Ping Test", "Ping was okay") Else MsgBox(0, "Ping Test", "Ping was not okay") EndIf Case $CONFIG Run("C:\SVR\Programe.exe") EndSwitch WEnd To simplyfy your script a little... Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 1, 2011 Author Share Posted April 1, 2011 Thank you for the reply, will try this and come back to you. Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 1, 2011 Author Share Posted April 1, 2011 Thanx again, the dropbox and ping are both working. One question only, after I selected the dropdown input how do i link that to the "OK" button so that it can preform a task. (Same as the "$JNB = GUICtrlCreateButton("JNB - A", 0, 8, 65, 25)to do the task Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"')" Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 4, 2011 Author Share Posted April 4, 2011 $s_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15" $s_data25 = $s_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 " $s_data35 = $s_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35" $s_data45 = $s_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45" After one of the above "ARC's"is selected in the dropdown, what string of code do I use to tell the "OK" what to do. Please HELP !!!!!!!!!! Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 4, 2011 Share Posted April 4, 2011 $s_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15"$s_data25 = $s_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 "$s_data35 = $s_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35"$s_data45 = $s_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45"After one of the above "ARC's"is selected in the dropdown, what string of code do I use to tell the "OK" what to do.Please HELP !!!!!!!!!!Im not quite sure what you want to do.Do you want to perform code when the dropdown is selected? Or do you want to find a way to retrieve what the user selected in the dropdown when you run the code???Both are relatively easy; Im just not sure what you are trying to do. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 4, 2011 Share Posted April 4, 2011 (edited) Ok.The structure you are using to get what is happening to buttons and what not is called polling for events.It involves constantly checking if something is happened.Whenever something happens, an event is generated, and is passed through$nMsg = GUIGetMsg()So the event is stored in $nMsg.Now, all we need to do is see what generated that event.Thats easy, because what $nMsg actually contains, is the handle to the thingie on the window that caused the event.So if you want to check if the combo box created an event, you would look to see if $PEARC is equal to $nMsg.In code, this would look like:$nMsg = GUIGetMsg() if $nMsg = $PEARC then Tooltip("THE COMBO BOX TRIGGERED AN EVENT!!!")or, if your checking for events in bulk, as in your script...$nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"') ;OK HERE IT IS!!!!! Case $PEARC Tooltip("THE COMBO BOX TRIGGERED AN EVENT!!!") EndSwitchAs you can see in both of the examples, the code is checking for events, and then comparing it to see if it is equal to the handle of the combo box. if it is, then we know that the combobox triggered the event, therefore it must of been selected.In these cases, when it is selected, it will run this code:Tooltip("THE COMBO BOX TRIGGERED AN EVENT!!!")To Get the contents of the Combo box and find out what the user actually selected, you must use a function. I cant remember what it is exactly off the top of my head, but I have a feeling it is...$PEARC_Selection = GUiCtrlRead($PEARC)Geddit?You pass it the handle/variable of the control you want to read the data of, and it will tell you the contents, in this case setting the variable $PEARC_Selection.Hope this helps,Hypoz Edited April 4, 2011 by hyperzap ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 4, 2011 Author Share Posted April 4, 2011 Thank You very much hyperzap for your effords, Yes the code you gave me does show that there was a trigger - ("THE COMBO BOX TRIGGERED AN EVENT!!!")but I need the selected item in the dropbox to preform a task "Telnet IP.ADDRESS PORT, each "ARC" is a specified device that I need to do some thing.Once this concept is working I can Implement this to do Remote Desktop as well to the specified devices. Kind Regards, Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 4, 2011 Share Posted April 4, 2011 Right. So firstly, you will need a spot for each of your buttons to perform its code, like have for all the other buttons. for example... Case $PINGB ;Do our code here... Now you need to have a way to detect the contents of the combo box and store it. $PEARC_Selection = GUiCtrlRead($PEARC) As before, stored as $PEARC_Selection. Now, the easiest thing to do for your level is just to 'check' if this variable, $PEARC_Selection, is equal to whatever the task is, and then perform code for the specific task. in code... $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"') ;here we go! Case $UT1 ;If this button is pressed $PEARC_Selection = GUiCtrlRead($UTARC) ;We are getting the selection of the corresponding dropdown Switch $PEARC_Selection ;Does this look familiar??? Case "ARC 27" ToolTip("This is where we would put the code to correspond to this action, ARC 27.") Case "ARC 28" ToolTip("This is where we would put the code to correspond to this action, ARC 28.") EndSwitch I hope this answers your question. There are better solutions that do not involve so much copying and pasting by they involve combining logical comparisions, or loops, and you havent learnt that yet I dont think. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 4, 2011 Author Share Posted April 4, 2011 Thanx once again hyperzap, I will have a look at this read up some more and come back to you. The student is lurning...... lol Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 4, 2011 Share Posted April 4, 2011 I will be away for 9 days from now. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
UEZ Posted April 4, 2011 Share Posted April 4, 2011 Do you mean something like this: expandcollapse popup#include <ComboConstants.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <GuiIPAddress.au3> #include <WindowsConstants.au3> $s_data15 = "ARC 1|ARC 2|ARC 3|ARC 4|ARC 5|ARC 6|ARC 7|ARC 8|ARC 9|ARC 10|ARC 11|ARC 12|ARC 13|ARC 14|ARC 15" $s_data25 = $s_data15 & "|ARC 16|ARC 17|ARC 18|ARC 19|ARC 20|ARC 21|ARC 22|ARC 23|ARC 24|ARC 25 " $s_data35 = $s_data25 & "|ARC 26|ARC 27|ARC 28|ARC 29|ARC 30|ARC 31|ARC 32|ARC 33|ARC 34|ARC 35" $s_data45 = $s_data35 & "|ARC 36|ARC 37|ARC 38|ARC 39|ARC 40|ARC 41|ARC 42|ARC 43|ARC 44|ARC 45" $CCTV = GUICreate("RSA CCTV SERVERS", 560, 327, 200, 113, BitOR($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_GROUP, $WS_TABSTOP, $WS_BORDER, $WS_CLIPSIBLINGS)) $JNB = GUICtrlCreateButton("JNB - A", 0, 8, 65, 25) $CT = GUICtrlCreateButton("CT - A", 70, 8, 65, 25) $DBN = GUICtrlCreateButton("DBN - A", 140, 8, 65, 25) $PE = GUICtrlCreateButton("PE - A", 210, 8, 65, 25) $EL = GUICtrlCreateButton("EL - A", 280, 8, 65, 25) $UT = GUICtrlCreateButton("UT - A", 350, 8, 65, 25) $BFT = GUICtrlCreateButton("BFT - A", 420, 8, 65, 25) $CORP = GUICtrlCreateButton("CORP - A", 490, 8, 65, 25) $JNBARC = GUICtrlCreateCombo("JNBARC", 0, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data45) $CTARC = GUICtrlCreateCombo("CTARC", 70, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data35) $DBNARC = GUICtrlCreateCombo("DBNARC", 140, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data25) $PEARC = GUICtrlCreateCombo("PEARC", 210, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $ELARC = GUICtrlCreateCombo("ELARC", 280, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $UTARC = GUICtrlCreateCombo("UTARC", 350, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $BFTARC = GUICtrlCreateCombo("BFTARC", 420, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $CORPARC = GUICtrlCreateCombo("CORPARC", 490, 46, 65, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $s_data15) $IPAddress1 = _GUICtrlIpAddress_Create($CCTV, 0, 279, 130, 25) _GUICtrlIpAddress_Set($IPAddress1, "0.0.0.0") $JNB1 = GUICtrlCreateButton("OK", 0, 80, 65, 17) $CT1 = GUICtrlCreateButton("OK", 70, 80, 65, 17) $DBN1 = GUICtrlCreateButton("OK", 140, 80, 65, 17) $PE1 = GUICtrlCreateButton("OK", 210, 80, 65, 17) $EL1 = GUICtrlCreateButton("OK", 280, 80, 65, 17) $UT1 = GUICtrlCreateButton("OK", 350, 80, 65, 17) $BFT1 = GUICtrlCreateButton("OK", 420, 80, 65, 17) $CORP1 = GUICtrlCreateButton("OK", 490, 80, 65, 17) $PINGB = GUICtrlCreateButton("GO", 135, 279, 35, 25) $JNBRAID = GUICtrlCreateButton("JNB - R", 0, 120, 65, 25) $CTRAID = GUICtrlCreateButton("CT - R", 70, 120, 65, 25) $DBNRAID = GUICtrlCreateButton("DBN - R", 140, 120, 65, 25) $PERAID = GUICtrlCreateButton("PE - R", 210, 120, 65, 25) $ELRAID = GUICtrlCreateButton("EL - R", 280, 120, 65, 25) $UTRAID = GUICtrlCreateButton("UT - R", 350, 120, 65, 25) $BFTRAID = GUICtrlCreateButton("BFT - R", 420, 120, 65, 25) $CORPRAID = GUICtrlCreateButton("CORP - R", 490, 120, 65, 25) $CONFIG = GUICtrlCreateButton("CONFIG", 184, 280, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $JNB RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA.vbs"') Case $JNB1 MsgBox(0, "Information", "OK was pressed. Combo value is: " & _GUICtrlComboBox_GetEditText($JNBARC)) Case $CT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA.vbs"') Case $DBN RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA.vbs"') Case $PE RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA.vbs"') Case $EL RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL.vbs"') Case $UT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA.vbs"') Case $BFT RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT.vbs"') Case $CORP RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC.vbs"') Case $JNBRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ORTIA RAIDS.vbs"') Case $CTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\CTIA RAIDS.vbs"') Case $DBNRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\KSIA RAIDS.vbs"') Case $PERAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\PEIA RAIDS.vbs"') Case $ELRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\EL RAIDS.vbs"') Case $UTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\UIA RAIDS.vbs"') Case $BFTRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\BFT RAIDS.vbs"') Case $CORPRAID RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ACSAC RAIDS.vbs"') Case $PINGB $s_ip = _GUICtrlIpAddress_Get($IPAddress1) If Ping($s_ip) > 0 Then MsgBox(0, "Ping Test", "Ping was okay") Else MsgBox(0, "Ping Test", "Ping was not okay") EndIf Case $CONFIG Run("C:\SVR\Programe.exe") EndSwitch WEnd You can select a value from 1st combobox and click the ok bottom below. Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 5, 2011 Author Share Posted April 5, 2011 Hi UEZ, Once again thank you for all your efforts on this. Yes this brings up a MSG box, I have found a way to do what I need it to but it is long. Please have a at code below: [autoit][/autoit] This is what I came up with, I know that this is not the right way but this is how I have tried and it works. If you have a look maybe you can simplify it better, all I need to do is link wat ever is chosen in the dropdown box e.g. "ARC 1" links to IP address and when you click "OK" button it will then telnet to the server ....... Hopefully you can understand this better. The student is learning more everyday. Kind Regards Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 5, 2011 Author Share Posted April 5, 2011 Sorry forgot the fileTest2.4.au3 Link to comment Share on other sites More sharing options...
UEZ Posted April 5, 2011 Share Posted April 5, 2011 (edited) I've some questions:What do you mean with "ARC 1" links to IP address and when you click "OK" button it will then telnet to the server?When you click on ok then this command should run?: telnet <ip associated with ARC 1>?You are using these lines with :... Case $JNB1 ;If this button is pressed $JNBARC_Selection = GUiCtrlRead($JNBARC) ;We are getting the selection of the corresponding dropdown Switch $JNBARC_Selection ;Does this look familiar??? Case "ARC 1" RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ARC\JNB1.vbs"') Case "ARC 2" RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ARC\JNB2.vbs"') Case "ARC 3" RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ARC\JNB3.vbs"') Case "ARC 4" RunWait(@ComSpec & ' /c WScript.exe "C:\SVR\ARC\JNB4.vbs"') Case "ARC 5" ...What are these vbs scripts doing? Starting telnet? I would use instead of ARC x JNBx because you don't need to do all the case checks - just read out the selection and you have the name for the vbs!Br,UEZ Edited April 5, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 6, 2011 Author Share Posted April 6, 2011 Hi UEZ, If u run the .vbs script it opens a .txt file gets the IP address in it, then a telnet session and then sends commands that need to be done. If you look at the picture you will see what I mean. Like I said in the beginning I am realy a newb when it comes to coding, so I am learning more everyday on how to improve the method and what is the better commands to use. The script I posted yesterday is a long winded way of completing the task at hand, but that is the only way I know how to do it. Please let me know if you require any more info on this. Thax again for all the efforts. Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 13, 2011 Author Share Posted April 13, 2011 Case $JNBRMT1 $JNBRMT_Selection = GUiCtrlRead($JNBRMT) Switch $JNBRMT_Selection Case "ARC 1" $sfileSpec = "C:\CCTV\Rmt\JNB\JNB1.ini" $file = FileOpen($sfileSpec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sFileSpec & "'") Exit EndIf While 2 $sLine = FileReadLine($file) If @error = -1 Then ExitLoop $sWindowTitle = "Remote Desktop Connection" & $sLine $result = Run("C:\WINDOWS\system32\mstsc.exe" & $sLine) if $result <> 0 Then Sleep(500) WinActivate($sWindowTitle) Sleep(200) Else MsgBox(0, "Error", "Failed to run Telnet for server '" & $sLine & "'!") EndIf WendHi good people, I have struck a brick wall now. I need to open a "RDC" session and have a ip tiped in from a txt file. Example: I know that this one works for Telnet but I need some thing like this. Thank in advance again. Link to comment Share on other sites More sharing options...
twitchyliquid64 Posted April 13, 2011 Share Posted April 13, 2011 Case $JNBRMT1 $JNBRMT_Selection = GUiCtrlRead($JNBRMT) Switch $JNBRMT_Selection Case "ARC 1" $sfileSpec = "C:\CCTV\Rmt\JNB\JNB1.ini" $file = FileOpen($sfileSpec, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open data file: '" & $sFileSpec & "'") Exit EndIf While 2 $sLine = FileReadLine($file) If @error = -1 Then ExitLoop $sWindowTitle = "Remote Desktop Connection" & $sLine $result = Run("C:\WINDOWS\system32\mstsc.exe" & $sLine) if $result <> 0 Then Sleep(500) WinActivate($sWindowTitle) Sleep(200) Else MsgBox(0, "Error", "Failed to run Telnet for server '" & $sLine & "'!") EndIf WendHi good people, I have struck a brick wall now. I need to open a "RDC" session and have a ip tiped in from a txt file. Example: I know that this one works for Telnet but I need some thing like this. Thank in advance again. Sorry. I have apsolutely no experience with Remote Desktop. ongoing projects:-firestorm: Largescale P2P Social NetworkCompleted Autoit Programs/Scripts: Variable Pickler | Networked Streaming Audio (in pure autoIT) | firenet p2p web messenger | Proxy Checker | Dynamic Execute() Code Generator | P2P UDF | Graph Theory Proof of Concept - Breadth First search Link to comment Share on other sites More sharing options...
CH0VI3 Posted April 17, 2011 Author Share Posted April 17, 2011 Hi people, Is there anyone that can maybe assist me with my problem please, I need remote desktop to open and use the information provided by the dropdown tab and connect. Thank you once again for any assistance in this matter. Kind Regards CH0VI3 Link to comment Share on other sites More sharing options...
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