Jump to content

Creating a command window- cant get an input

Recommended Posts


im relatively new to AutoIT and want to create a command window to run various functions. when i press - i want the input window to come up and let me type in what i want and it will then store that in a variable to be used. however, it doesnt seem to be taking what i type as the input.


how can i make this work. i know i could use InputBox(), but i am trying to use GUIs as i want it to have a custom look.

Global $GUIstate = 0
Global $inputer

Func openGUI()
   #Region ### START Koda GUI section ### Form=
   $Command = GUICreate("Command", 286, 21, 10, 620)
   GUISetIcon("C:\Windows\System32\cmd.exe", -1)
   $inputer = GUICtrlCreateInput("", 1, 0, 300, 23)
   GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
   GUICtrlSetColor(-1, 0x000000)
   #EndRegion ### END Koda GUI section ###
   $GUIstate = 1

Func closeGUI()
   $input = GUICtrlRead("$inputer")
   $GUIstate = 0
   MsgBox(0,"command given",$input);;Want to know what I put in the box

While 1
   If  $GUIstate = 0 Then
   If  $GUIstate = 1 Then

thanks in advance for your help <3

Share this post

Link to post
Share on other sites

If you want to use already declared variable you use it without quotes, what you have done in your line with MsgBox() function like this 


There is another posibiility, using Eval, but you should read remarks for that function first:


Same goes for line where you delete your GUI.

Share this post

Link to post
Share on other sites

thank you so much <3:D


When you create the control you are storing the control id in the variable that you submit:

$inputer = GUICtrlCreateInput("", 1, 0, 300, 23)

$inputer have the value (Auto Increment) of the control ID. In your case $inputer have the value of 3. This can change if you put a code to create another control above this line.

Edited by GordonFreeman

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

  • Create New...