Sign in to follow this  
Followers 0
Licam

Looped If

7 posts in this topic

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

Share this post


Link to post
Share on other sites



Licam,

HotKeySet("{g}", "Rays")

"Rays"? And what game is this designed to bot? ;)

Did you read the Forum Rules before posting? :)

M23

P.S. If you are a marine biologist and are referring to the Batoidea then I apologise in advance. :D


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (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"? :)

M23

Sorry, 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 by ApudAngelorum

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0