Jump to content

Creating a command window- cant get an input


kendhc
 Share

Recommended Posts

Hey,

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)
   GUISetBkColor(0xC0C0C0)
   $inputer = GUICtrlCreateInput("", 1, 0, 300, 23)
   GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
   GUICtrlSetColor(-1, 0x000000)
   GUISetState(@SW_SHOW)
   #EndRegion ### END Koda GUI section ###
   $GUIstate = 1
EndFunc

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

While 1
   If  $GUIstate = 0 Then
      HotKeySet("-",openGUI)
   EndIf
   If  $GUIstate = 1 Then
      HotKeySet("-",closeGUI)
   EndIf
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   sleep(10)
WEnd

thanks in advance for your help <3

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