Sign in to follow this  
Followers 0
Slash2135

Input from GUI into cmd line?

3 posts in this topic

Hey everyone,

I am pretty new to AutoIT so I'm trying to figure out how everything works and what not. I found this cmd that is used to take ownership of Reg keys and thought it would be cool make a gui where the user simply puts the reg key into the input box and presses a button giving them ownership. This may sound dumb to some but for me and my IT team it would make our lives a little easier. The problem is, I don't know the command to take the input from the text box and insert it into the cmd line. I'm not asking anyone to write this for me, I'm just wanting a little advice and some direction.

Thanks!

Justin

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The Run and ShellExecute functions accept variables as arguments, so something like ShellExecute(GUICtrlRead($Input1), GUICtrlRead($Input2)) is doable.

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

I hope this will help you:

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 383, 131, 192, 124)
$Label = GUICtrlCreateLabel("Commandline:", 8, 48, 109, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input = GUICtrlCreateInput("ipconfig /all", 112, 48, 121, 21)
$Button = GUICtrlCreateButton("Start in CMD", 256, 48, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            GUIDelete($hGUI)
            Exit
        Case $Button
            $cmd = GUICtrlRead($Input)
            $pid = Run(@ComSpec & " /k " & $cmd, "")
    EndSwitch
WEnd

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!
¯\_(ツ)_/¯

Share this post


Link to post
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
Sign in to follow this  
Followers 0