Licam Posted April 14, 2012 Share Posted April 14, 2012 What is wrong with the code below? I would like to get it so that when i press g it chooses to press F1-6 one at a time per each press. Thanks HotKeySet("{g}", "Rays") Func Rays() Local $Paused = 0 Local $i = 1 While $Paused == 0 Do If $i = 1 Then Send("{F1}") ExitLoop ElseIf $i = 2 Then Send("{F2}") ExitLoop ElseIf $i = 3 Then Send("{F3}") ExitLoop ElseIf $i = 4 Then Send("{F4}") ExitLoop ElseIf $i = 5 Then Send("{F5}") ExitLoop ElseIf $i = 6 Then Send("{F6}") ExitLoop Else $i = 1 EndIf $i = $i + 1 Until $i = 6 WEnd EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2012 Moderators Share Posted April 14, 2012 Licam,HotKeySet("{g}", "Rays")"Rays"? And what game is this designed to bot? Did you read the Forum Rules before posting? M23P.S. If you are a marine biologist and are referring to the Batoidea then I apologise in advance. 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...
Skitty Posted April 14, 2012 Share Posted April 14, 2012 It's pretty hard to determine what the user intends to use this for given the odd function name he chose. But why is he doing it the way he chose is beyond me. why not do it something like ~ HotKeySet("{g}", "Rays") HotKeySet("{esc}", "esc") Sleep(99999999999) Func Rays() Send("{F1}") Sleep(500) Send("{F2}") Sleep(500) Send("{F3}") Sleep(500) Send("{F4}") Sleep(500) Send("{F5}") Sleep(500) Send("{F6}") Return EndFunc ;==>Rays Func esc() Exit EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2012 Moderators Share Posted April 14, 2012 ApudAngelorum,I am intrigued - what gives you the impression the posting anything helpful in a thread where a Mod has already indicated that it is probably against the Forum rules is a "good idea"? 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...
Skitty Posted April 14, 2012 Share Posted April 14, 2012 (edited) ApudAngelorum,I am intrigued - what gives you the impression the posting anything helpful in a thread where a Mod has already indicated that it is probably against the Forum rules is a "good idea"? M23Sorry, I just assumed the use for this wasn't automating a game, it seems weird that he'd want to press those control keys in that order now that you mention it. And since you didn't lock it, I thought it'd be alright, especially since the targeted action is so basic.And now that the OP hasn't responded at all, it only adds to the probability that this is indeed intended for some kind of game.Wont happen again~ Edited April 14, 2012 by ApudAngelorum Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 14, 2012 Moderators Share Posted April 14, 2012 ApudAngelorum, I will only lock a thread if it is against the rules - but it seems sensible to me that others keep out of the thread if a Mod asks someone a question to elicit more information. As I explained in my P.S. to the OP, if he is a marine biologist I would be very happy for the thread to continue as I am actually very fond of those fish (particularly on my plate ). 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...
Licam Posted April 14, 2012 Author Share Posted April 14, 2012 It is generalized code where when I press one key, I'd like to be able to have a different key press each time and then loop back through. This is not for a game, but I am working on a repetitive process and just threw this together. This is the first time I have tried to do any coding with AutoIt and was trying to figure out some more of the mechanics as well. Sorry for any confusion with it. 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