Hypertrophy Posted July 17, 2009 Share Posted July 17, 2009 how do i press ok on an input box i created? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 17, 2009 Moderators Share Posted July 17, 2009 Hypertrophy ,Short answer: with the mouse! Longer answer: store the ControlID of the control and then check if GUIGetMsg() returns it:#include <GUIConstantsEx.au3> ; Create GUI $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 480, 20) $hButton = GUICtrlCreateButton("OK", 10, 100, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton MsgBox(0,"Result", "You pressed the button!") Exit EndSwitch WEndThis is really basic stuff.......M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tekki Posted July 17, 2009 Share Posted July 17, 2009 (edited) how do i press ok on an input box i created? You could do what Melba23 said or you can have it much simpler Inputbox("Title","Prompt") If @error = 1 Then Exit ; You press cancel If you want the information from the inputbox to be used for something else: $var = Inputbox("Title","Prompt") If @error = 1 Then Exit ; You press cancel If MsgBox(4,"Title,"Message " & $var) = 7 Then Exit There is a lot of possible uses for that I just used MsgBox as an example! Hope it helps EDIT: Typo Edited July 17, 2009 by Tekki If you intend to use Sarcasm you must this sticker!!![size="1"][sub]pic made by manadar[/sub][/size] Link to comment Share on other sites More sharing options...
Hypertrophy Posted July 17, 2009 Author Share Posted July 17, 2009 Hypertrophy , Short answer: with the mouse! Longer answer: store the ControlID of the control and then check if GUIGetMsg() returns it: #include <GUIConstantsEx.au3> ; Create GUI $hGUI = GUICreate("Test", 500, 500) $hInput = GUICtrlCreateInput("", 10, 10, 480, 20) $hButton = GUICtrlCreateButton("OK", 10, 100, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton MsgBox(0,"Result", "You pressed the button!") Exit EndSwitch WEnd This is really basic stuff....... M23 I'm sorry. What I meant was the OK button in InputBox(...) Link to comment Share on other sites More sharing options...
lordicast Posted July 17, 2009 Share Posted July 17, 2009 This is basic, When you open a InputBox the OK button is already focused on so all you have to do is Send('{Enter}') [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
Hypertrophy Posted July 17, 2009 Author Share Posted July 17, 2009 This is basic, When you open a InputBox the OK button is already focused on so all you have to do is Send('{Enter}')Yeah, and that's why I made this thread. I've been trying that and it's not working. Link to comment Share on other sites More sharing options...
GEOSoft Posted July 17, 2009 Share Posted July 17, 2009 Take a look at ControlClick() in the help file. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Developers Jos Posted July 17, 2009 Developers Share Posted July 17, 2009 (edited) Yeah, and that's why I made this thread. I've been trying that and it's not working.Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?(It always helps to show a code snippet showing your issue) Edited July 17, 2009 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
GEOSoft Posted July 17, 2009 Share Posted July 17, 2009 Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?(It always helps to show a code snippet showing your issue)That's what it reads like to me and "mine is not to reason why... ". George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
CodyBarrett Posted July 18, 2009 Share Posted July 18, 2009 Input box pauses the script.... run a secondary script to press Ok and that should do it [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Hypertrophy Posted July 18, 2009 Author Share Posted July 18, 2009 Do you mean to say you have an InpuBox() statement in the script and you want the same script to click the OK button?(It always helps to show a code snippet showing your issue)Yes. But after reading what CodyBarret read I think his suggestion is a solution. Link to comment Share on other sites More sharing options...
martin Posted July 18, 2009 Share Posted July 18, 2009 Yes. But after reading what CodyBarret read I think his suggestion is a solution. I don't know what CodeyBarret suggested but this should work. #include <timers.au3> $g = GUICreate("dummy window") $t1 = _Timer_SetTimer($g,100,"checkip") $ans = InputBox("title01","prompt","") func checkip($a,$b,$c,$d) if winexists("title01") Then _Timer_KillTimer($g,$t1) msgbox(262144,"Input Box detected","OK button on Input Box will be pressed") controlclick("title01","","Button1") EndIf EndFunc 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 More sharing options...
Hypertrophy Posted July 18, 2009 Author Share Posted July 18, 2009 ahh perfect! thank you martin. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 18, 2009 Developers Share Posted July 18, 2009 Yes. But after reading what CodyBarret read I think his suggestion is a solution.The question remain why you would want to have the script open an InputBox() and then have the script close it again?If you want to wait for a particular time for an answer and then timeout, you could use the proper parameter for that in the InputBox() statement. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Hypertrophy Posted July 18, 2009 Author Share Posted July 18, 2009 The question remain why you would want to have the script open an InputBox() and then have the script close it again?If you want to wait for a particular time for an answer and then timeout, you could use the proper parameter for that in the InputBox() statement. JosWell when the InputBox() opens I set it's default value to ClipGet(). So I wanted to automate it where it would press ok which would then write to a file. 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