Sign in to follow this  
Followers 0
alpha123

can someone "try" to help me

11 posts in this topic

could someone create a script that would repeatedly press the "tab" key like infinite times? i cant quite understand how this stuff works i read on it and some samples but cant grasp it

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

could someone create a script that would repeatedly press the "tab" key like infinite times? i cant quite understand how this stuff works i read on it and some samples but cant grasp it

Welcome to the forums! Read through this, the answer lies within, including an example script at the bottom.

You can also find this info in your own Help File that came with your AutoIt installation.

Go ahead and try it based off what you read and if you're still having trouble then we'll see if we can't hook you up with a more direct example.

Edited by exodius

Share this post


Link to post
Share on other sites

i think i understand from that page... lemme give it a go. i looked through the help thing but there was tons of different topics couldnt find one on what i needed (or in a language i understood haha)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Shift + Z Starts and stops the program. To close it , right click the icon on your task bar. I will explain the code in the first edit.

HotKeySet ( "Z", "_Go")

While 1
     Sleep ( 500 )
WEnd

Func _Go()
     $Paused = NOT $Paused
          While $Paused
               Send("{TAB}")
          WEnd
EndFunc

HotKeySet --> You can helpfile this. This binds the key in the first parameter to the function in the second param.

While --> This does 2 things. It gives the program something to do while it waits for you to toggle your functions via hotkey , and it can also be used for a loop for other purposes ( as shown in the 2nd use of the statement ).

Wend --> Ends the previous While statement ( loop ).

$ --> States a variable. A variable can be numeric , or alphabetic. If you set it as a string , the string must be in quotes ""'s. Like this: $Var = "Hello"

Send --> You can helpfile this. It sends keystrokes to the active window.

EndFunc --> Ends the called function.

NOTE: All of this can be searched in the helpfile to get a better understanding and some more examples to show its usage.

----

Hope all that helps :).

*Drew

Edited by Drew

Share this post


Link to post
Share on other sites

does the sleep(500) mean it would repeat itself 500 times?

Share this post


Link to post
Share on other sites

oh nevermind i found answer to that question in help thing =D

Share this post


Link to post
Share on other sites

The help file in autoit is the most useful help file I have ever worked with, bar none, and I have 20+ years of IT experience to compare against.

Its integration with SciTE makes using it completely effortless and intuitive.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

I would quickly agree with everything you just said.

However, I feel that sometimes people just starting out using AutoIt as their first language can feel overwhelmed at times ( as anyone could using any language ) and ultimately give up. ( There are exceptions. ) So sometimes "spoonfeeding" once or twice is okay, as long as you explain WHY it is the way it is.

Share this post


Link to post
Share on other sites

Aw man... lol.

I'm new to the forums and this was a question I could have actually answered! Doh! Lol.

I did manage to learn something from Drew by reading this post however... I did not know that you could insert hot-keys to pause/resume your scripts!

Thanks =)

I usually just resort to things like...

dim $x
While 1
    While $x<50
        Send("{TAB}")
        $x+=$x
    WEnd
$x=0
Sleep(5000);5 seconds pause so you can escape the script if you wanted, hahaha, thanks Drew =p
WEnd

Share this post


Link to post
Share on other sites

I would quickly agree with everything you just said.

However, I feel that sometimes people just starting out using AutoIt as their first language can feel overwhelmed at times ( as anyone could using any language ) and ultimately give up. ( There are exceptions. ) So sometimes "spoonfeeding" once or twice is okay, as long as you explain WHY it is the way it is.

Rather than spoonfeeding, I prefer to show them more directly the way (the functions they should look at and play with to accomplish what they want) and hope that they'll actually try it first and then come back with something that didn't work so we can show them what they did wrong...

alpha123 seems like the right sort of person (just puzzled, needed a nudge in the right direction) but I don't like the notion of writing scripts for people, which some people do come in here looking for.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Rather than spoonfeeding, I prefer to show them more directly the way (the functions they should look at and play with to accomplish what they want) and hope that they'll actually try it first and then come back with something that didn't work so we can show them what they did wrong...

alpha123 seems like the right sort of person (just puzzled, needed a nudge in the right direction) but I don't like the notion of writing scripts for people, which some people do come in here looking for.

I see this statement as right and wrong. Not so much "wrong", but just that I disagree.

My reasons:

"Spoonfeeding" accomplishes two things: Gives kiddies who don't even plan on attempting to learn the language what they want so they can run along and stop wasting our time. AND ( as shown in this post ) it can also help others who just happen to browse the page learn something new or explain something they've been having trouble with.

Now on the points I agree with, asking the person to do a little work themselves is completely understandible and more the often times expected. But for little 30 second scripts like this, does it hurt to bring your own knoweledge to the table instead of pointing to the help file?

Just my thoughts.

And your more than welcome alpha and myxomatosii :P. I'm very glad to see you two got something out of it. If either of you ever need anything else explained a little deeper, feel free to message me :unsure:.

Edited by Drew

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