SoundOfDeath Posted February 6, 2010 Share Posted February 6, 2010 (edited) Alright, I made this simple script: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\documents and settings\laptops&zo\bureaublad\autoit\form\search test.kxf $Form1 = GUICreate("Beta", 225, 105, 192, 124) $Group1 = GUICtrlCreateGroup("Char Information", 8, 8, 209, 89) $Label1 = GUICtrlCreateLabel("Name:", 16, 32, 35, 17) $Label3 = GUICtrlCreateLabel("Unknow", 96, 32, 67, 17) $Input2 = GUICtrlCreateInput("", 72, 64, 121, 21) $Label14 = GUICtrlCreateLabel("Search:", 16, 64, 41, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit HotKeySet("{Enter}", "search") Sleep (10) EndSwitch WEnd Func search() GUICtrlSetData ($Label3, "Random") EndFunc When I hit enter Unknown should change to Random, but it doesn't I tryed some other things to let it work, like changing the hotkey, but it still doesn't work and I can't find the problem here, if someone can help me with this I would really appreciate it. ~Thanks for reading! Edited February 6, 2010 by SoundOfDeath Link to comment Share on other sites More sharing options...
Developers Jos Posted February 6, 2010 Developers Share Posted February 6, 2010 This one seems to work for me: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=c:\documents and settings\laptops&zo\bureaublad\autoit\form\search test.kxf HotKeySet("{Enter}", "search") $Form1 = GUICreate("Beta", 225, 105, 192, 124) $Group1 = GUICtrlCreateGroup("Char Information", 8, 8, 209, 89) $Label1 = GUICtrlCreateLabel("Name:", 16, 32, 35, 17) $Label3 = GUICtrlCreateLabel("Unknow", 96, 32, 67, 17) $Input2 = GUICtrlCreateInput("", 72, 64, 121, 21) $Label14 = GUICtrlCreateLabel("Search:", 16, 64, 41, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func search() GUICtrlSetData($Label3, "Random") EndFunc ;==>search 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...
Moderators Melba23 Posted February 6, 2010 Moderators Share Posted February 6, 2010 SoundOfDeath,Welcome to the AutoIt forum! Your code does work, but needs a couple of tweaks. First, move the HotKeySet to the top of the script, you only need to declare it once, not every time you loop. Second, you do not need a Sleep in your loop if you use GUIGetMsg() - the function does the CPU idle for you (look in the Help file for GUIGetMsg ).So your script becomes: #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet("{ENTER}", "search") #Region ### START Koda GUI section ### Form=c:\documents and settings\laptops&zo\bureaublad\autoit\form\search test.kxf $Form1 = GUICreate("Beta", 225, 105, 192, 124) $Group1 = GUICtrlCreateGroup("Char Information", 8, 8, 209, 89) $Label1 = GUICtrlCreateLabel("Name:", 16, 32, 35, 17) $Label3 = GUICtrlCreateLabel("Unknowm", 96, 32, 67, 17) $Input2 = GUICtrlCreateInput("", 72, 64, 121, 21) $Label14 = GUICtrlCreateLabel("Search:", 16, 64, 41, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func search() GUICtrlSetData ($Label3, "Random") EndFuncM23 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...
SoundOfDeath Posted February 6, 2010 Author Share Posted February 6, 2010 Thanks Jos & Melba23 for the help knew it was only such a easy thing also thanks for the welcome Melba23 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