sgrasso Posted December 4, 2009 Posted December 4, 2009 i would like to take the chosen value from two combo box's and one input box and pipe them into an external vb script i have created a basic gui with the combo boxes and input box and one button which ideally could start the process. any help would be appeciated. my autoit script #include <GUIConstantsEx.au3> Local $hGUI, $Combo, $Btn Local $msg $hGUI = GUICreate("Add_User", 400, 400) $Combo = GUICtrlCreateCombo("server01", 10, 12, 200, 25) GUICtrlSetData(-1, "server02|server03") $Combo2 = GUICtrlCreateCombo("Administrators", 10, 124, 200, 25) GUICtrlSetData(-1, "Guests|Users") GuiCtrlCreateInput("domain/user", 10, 236, 200, 25) $Btn = GUICtrlCreateButton("ADD", 300, 24, 70, 50) $Btn2 = GUICtrlCreateButton("EXIT", 300, 284, 70, 50) GUISetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd
martin Posted December 4, 2009 Posted December 4, 2009 i would like to take the chosen value from two combo box's and one input box and pipe them into an external vb scripti have created a basic gui with the combo boxes and input box and one button which ideally could start the process.any help would be appeciated.my autoit script#include <GUIConstantsEx.au3>Local $hGUI, $Combo, $BtnLocal $msg$hGUI = GUICreate("Add_User", 400, 400)$Combo = GUICtrlCreateCombo("server01", 10, 12, 200, 25)GUICtrlSetData(-1, "server02|server03")$Combo2 = GUICtrlCreateCombo("Administrators", 10, 124, 200, 25)GUICtrlSetData(-1, "Guests|Users")GuiCtrlCreateInput("domain/user", 10, 236, 200, 25)$Btn = GUICtrlCreateButton("ADD", 300, 24, 70, 50)$Btn2 = GUICtrlCreateButton("EXIT", 300, 284, 70, 50)GUISetState()While GuiGetMsg() <> $GUI_EVENT_CLOSEWEndIf you only need to send a small amount of text, and the speed does not have to be really high, then I think the easiest way is to use ControlSend. You could send the text to an edit in the VB script for example and the edit need not even be visible. The VB script just has to read the edit to see what the text is. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
sgrasso Posted December 8, 2009 Author Posted December 8, 2009 is there a way to grab the value's chosen for combo box 1 , combo box 2 and the input box and insert them as the "string" parameter with ControlSend ?
martin Posted December 8, 2009 Posted December 8, 2009 is there a way to grab the value's chosen for combo box 1 , combo box 2 and the input box and insert them as the "string" parameter with ControlSend ? Yes, look up GuiCtrlRead. [auotit] $sCombo2test = GuiCtrlRead($Combo2) $sIp1text = GuiCtrlRead($Input) ControlSend("some windowTitle (casesensitive!)","","Edit1","Combo2 contains " & @CRLF & $sCombo2text & @CRLF & "Input1 contains " & @CRLF & $sIn1text) [/autoit] Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
sgrasso Posted December 29, 2009 Author Posted December 29, 2009 with some modifications it works, thanks! based on the choices made in the gui this will send those choices as variable to a second script and then execute. #include <GUIConstantsEx.au3> $b = True If $b = True Then FileInstall("C:\addtogroup.wsf", "C:\Temp\addtogroup.wsf") Opt("GUIOnEventMode", 1) Local $Btn, $Btn2 Local $hGUI, $Combo Local $msg Local $sCombo2test, $slp1text, $Combo2, $Input $hGUI = GUICreate("Add_User", 400, 400) $Combo = GUICtrlCreateCombo("server01", 10, 12, 200, 25) GUICtrlSetData(-1, "server02|server03") $Combo2 = GUICtrlCreateCombo("Administrators", 10, 124, 200, 25) GUICtrlSetData(-1, "Guests|Users") $Input=GuiCtrlCreateInput("domain/user", 10, 236, 200, 25) $Btn = GUICtrlCreateButton("ADD", 300, 24, 70, 50) $Btn2 = GUICtrlCreateButton("EXIT", 300, 284, 70, 50) GUICtrlSetOnEvent($Btn, "ADDButton") GUICtrlSetOnEvent($Btn2, "EXITButton") GUISetState() Func ADDButton() $sCombotext = GUICtrlRead($Combo) $sCombo2text = GUICtrlRead($Combo2) $slp1text = GUICtrlRead($Input) Run ("cmd.exe", @Systemdir, @SW_MINIMIZE) WinWait("[C:\WINDOWS\system32\cmd.exe]", "", 30) $sCombo2text & @CRLF & "Combo contains" & @CRLF & $sCombotext) ControlSend ("C:\WINDOWS\system32\cmd.exe","","","Cscript c:\Temp\addtogroup.wsf /s:" & $sCombotext & " /g:" & $sCombo2text & " /a:" & $slp1text & @CRLF) WinWait("[C:\WINDOWS\system32\cmd.exe]", "", 30) ControlSend ("C:\WINDOWS\system32\cmd.exe","","","EXIT" & @CRLF) EndFunc Func EXITButton() Exit EndFunc While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd
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