GeekyBunny Posted May 23, 2013 Share Posted May 23, 2013 How do i set a hotkey to a button i made in the Graphical user interface in koda? Well, yet again, i'm a newbie to this. Your help will be appreciated. Link to comment Share on other sites More sharing options...
olo Posted May 23, 2013 Share Posted May 23, 2013 How do i set a hotkey to a button i made in the Graphical user interface in koda? Well, yet again, i'm a newbie to this. Your help will be appreciated. Any code or something to help explain a bit more of what you need? Link to comment Share on other sites More sharing options...
mrflibblehat Posted May 23, 2013 Share Posted May 23, 2013 How do i set a hotkey to a button i made in the Graphical user interface in koda? Well, yet again, i'm a newbie to this. Your help will be appreciated. Have a look at HotKeySet, Whatever function that button is calling get the hotkey to call the same function. [font="'courier new', courier, monospace;"]Pastebin UDF | Prowl UDF[/font] Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 23, 2013 Moderators Share Posted May 23, 2013 As olo pointed out, how about posting the code for the GUI you created? Help us help you olo 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
GeekyBunny Posted May 23, 2013 Author Share Posted May 23, 2013 (edited) As i said, "I'm new your help would be greatly appreciated Well, This is a program i am making for paint. I want it to click around 7 times whenever i press a special key. Plus, I want a hotkey set to $Button1. So that i don't have to press start everytime. Well, here is the code : #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 251, 245, 927, 209) $Button1 = GUICtrlCreateButton("Start", 24, 16, 75, 25) $Button2 = GUICtrlCreateButton("Instructions", 24, 64, 75, 25) $Button3 = GUICtrlCreateButton("Quit", 24, 104, 75, 25) $Label1 = GUICtrlCreateLabel("Made by GeekyBunny", 128, 96, 84, 81) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $Button1 <> 0 then MouseClick("Left") MouseWheel("Down") MouseClick("Left") MouseWheel("Down") MouseClick("Left") MouseWheel("Down") EndIf Case $Button2 MsgBox(0,"Instructions","Try") Case $Button3 Exit EndSwitch WEnd Edited May 23, 2013 by GeekyBunny Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 23, 2013 Moderators Share Posted May 23, 2013 (edited) I guess I am confused. You say you want to take some action on $Button1, but you don't want to click it all the time. How is your program to know you want to take said action if you don't click the button? And if you set a hotkey to perform the same steps as clicking the button, aren't you doubling your effort for the same number of clicks/button presses? Edit: To answer your question, despite the confusion your approach brings me - you would look at HotKeySet in the help file sd mrflibblehat suggested. Edited May 23, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 23, 2013 Share Posted May 23, 2013 You can put the mouse actions in a For..Next loop. I think that's what you're trying to accomplish. See http://www.autoitscript.com/autoit3/docs/keywords/For.htm , and the example code there for usage. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
GeekyBunny Posted May 23, 2013 Author Share Posted May 23, 2013 I guess I am confused. You say you want to take some action on $Button1, but you don't want to click it all the time. How is your program to know you want to take said action if you don't click the button? And if you set a hotkey to perform the same steps as clicking the button, aren't you doubling your effort for the same number of clicks/button presses? Edit: To answer your question, despite the confusion your approach brings me - you would look at HotKeySet in the help file sd mrflibblehat suggested. (I can make only 4 more posts) Erm, sorry for troubling you what i meant to say is that the i want a hotkeyset as an alternative for the button i press so that i keep hitting the hotkey instead of going back to the form1 and click the button. Like isn't there a way to give the button a hotkey so that whenever i press a certain key, say, "F5", it completes a certain function which i had written in the button. Link to comment Share on other sites More sharing options...
Moderators Solution JLogan3o13 Posted May 23, 2013 Moderators Solution Share Posted May 23, 2013 Sure you can. Something like this: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> HotKeySet("{F5}", "_myFunc") Local $msg GUICreate("Test", 300, 300) $Button1 = GUICtrlCreateButton("Button 1", 10, 10, 100,30) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 _myFunc() EndSelect WEnd GUIDelete() Func _myFunc() If $msg = $Button1 Then MsgBox(0, "", "I got here from the button") Else MsgBox(0, "", "I got here from a hotkey") EndIf EndFunc "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
somdcomputerguy Posted May 23, 2013 Share Posted May 23, 2013 Just have HotKeySet and $Button1 call the same function. And you would need to move the $Button1 actions (which are currently in the Switch) to a separate function. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
GeekyBunny Posted May 23, 2013 Author Share Posted May 23, 2013 Thank you guys very much! It might be a bother but you guys would be getting way more questions from me >_> But i am very thankful to you guys! And the helpful community Link to comment Share on other sites More sharing options...
GeekyBunny Posted May 23, 2013 Author Share Posted May 23, 2013 (2nd last post ) I can define my function anywhere? Right? Even at the end of the script, right? o-o Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 23, 2013 Moderators Share Posted May 23, 2013 (edited) Correct. Typically they are put at the end, after the "Main" portion of the script, but they can go anywhere. Edit: Fixed horrible spelling. Edited May 23, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 23, 2013 Moderators Share Posted May 23, 2013 GeekyBunny, I have lifted the "New Members" post restriction for you. M23 GeekyBunny 1 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...
GeekyBunny Posted May 23, 2013 Author Share Posted May 23, 2013 GeekyBunny, I have lifted the "New Members" post restriction for you. M23 Thank you very much! You guys are the best! :3 Now, i can post when i want without waiting till the morning but for now, All my problems are solved due to JLogan3o13's answer! But still thank you very much 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