Jump to content

pipe control input to external script


sgrasso
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

If 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.
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...