kendhc Posted December 21, 2015 Share Posted December 21, 2015 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) WEndthanks in advance for your help <3 Link to comment Share on other sites More sharing options...
ahmet Posted December 21, 2015 Share Posted December 21, 2015 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 GUICtrlRead($inputer)There is another posibiility, using Eval, but you should read remarks for that function first:GuiCtrlRead(Eval("inputer"))Same goes for line where you delete your GUI. Link to comment Share on other sites More sharing options...
kendhc Posted December 21, 2015 Author Share Posted December 21, 2015 this still doesnt seem to read the value, it just comes back with 0 despite what is typed in Link to comment Share on other sites More sharing options...
GordonFreeman Posted December 21, 2015 Share Posted December 21, 2015 Func closeGUI() $var = GUICtrlRead($inputer) GUIDelete("Command") $GUIstate = 0 MsgBox(0,"command given",$var);;Want to know what I put in the box EndFunc? kendhc 1 Frabjous Installation Link to comment Share on other sites More sharing options...
kendhc Posted December 21, 2015 Author Share Posted December 21, 2015 Func closeGUI() $var = GUICtrlRead($inputer) GUIDelete("Command") $GUIstate = 0 MsgBox(0,"command given",$var);;Want to know what I put in the box EndFunc?thank you so much <3 Link to comment Share on other sites More sharing options...
GordonFreeman Posted December 21, 2015 Share Posted December 21, 2015 (edited) thank you so much <3When 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 December 21, 2015 by GordonFreeman Frabjous Installation Link to comment Share on other sites More sharing options...
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