Sign in to follow this  
Followers 0
Elite_Gamer04

AutoIt able to....?

11 posts in this topic

Came across this great program last nite and am wondering if it is possible to make a script that will:

Press SpaceBar (Or desired keyboard button) after a certain number of seconds/minutes/hours continuosly until stoped? Im after this script to work in the active window which is open?

Thanks in advance

Elite_Gamer04

Share this post


Link to post
Share on other sites



Came across this great program last nite and am wondering if it is possible to make a script that will:

Press SpaceBar (Or desired keyboard button) after a certain number of seconds/minutes/hours continuosly until stoped? Im after this script to work in the active window which is open?

Thanks in advance

Elite_Gamer04

<{POST_SNAPBACK}>

Search the help file for: send() and Hotkeyset()

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thanks for the reply, I looked over what you suggested and still seem to not grasped it yet. This is what I've gathered so far:

1. The following will wait till the window named 'Blah' is active and then send the key simulation of a Spacebar press.

WinWaitActive("Blah")

Send("{Spacebar}")

2. From reading the Hotkeyset infomation I'm still trying to understand how to include the above into a script that will repeat the action every, lets say, 20 seconds until I return and press "Esc" key in the active window

Thanks again

Share this post


Link to post
Share on other sites

Thanks for the reply, I looked over what you suggested and still seem to not grasped it yet. This is what I've gathered so far:

1. The following will wait till the window named 'Blah' is active and then send the key simulation of a Spacebar press.

2. From reading the Hotkeyset infomation I'm still trying to understand how to include the above into a script that will repeat the action every, lets say, 20 seconds until I return and press "Esc" key in the active window

Thanks again

<{POST_SNAPBACK}>

Read the help file section about "loop statements" and the function sleep().

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks for the reply, I looked over what you suggested and still seem to not grasped it yet. This is what I've gathered so far:

1. The following will wait till the window named 'Blah' is active and then send the key simulation of a Spacebar press.

2. From reading the Hotkeyset infomation I'm still trying to understand how to include the above into a script that will repeat the action every, lets say, 20 seconds until I return and press "Esc" key in the active window

Thanks again

<{POST_SNAPBACK}>

Hi, how's it going? You can use a "Sleep ()" statement if you know the amount of time needed between each press of the spacebar. A standard loop statment should be good to keep the script running. If a window pops up each time you could use a "WinExists()" statement along with an "If... Else... ElseIf... EndIf" type statement as well. If you're using in a video game... just stick with the loop and "Sleep()" commands. :whistle: Edited by Frozenyam

"... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."

Share this post


Link to post
Share on other sites

We could give you the code right away but if we did so then you wouldnt really understand how autoit loops and if's work... It is better to take into consideration what the others told you and search on your own... But i'll give another hint...To make HotKeySet work you will have to work with functions.... So read about Func...EndFunc.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

We could give you the code right away but if we did so then you wouldnt really understand how autoit loops and if's work... It is better to take into consideration what the others told you and search on your own... But i'll give another hint...To make HotKeySet work you will have to work with functions.... So read about Func...EndFunc.

<{POST_SNAPBACK}>

We Could give him the code right away... but I don't think any of us really want to put forth THAT much effort when it seems as though the person in question hasn't really looked for a way to accomplish what he wants. I've been working with AutoIT v3 for about three days now and I've been able to script huge programs that do every thing from automate certain processes to auto responding in MSN. :whistle: So if I can do THAT in three days, I'm sure he could accomplish what he wants in a matter of minutes. Edited by Frozenyam

"... and the Lord said to John, "Come forth and ye shall receive eternal life," but instead John came fifth and won a toaster."

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thanks for your replies, I understand why you don't want to just give me the code and I appricate that.

The following is what I have 'Working' at the momment, It simulates the 'Spacebar' every 8 seconds until the 'Esc' key is pressed. What do you guys think, could I be coding it better? Also if I was to Alt-Tab lets say and open my Browser, will my script continue to work even though the active window is not what the script was written for?:

WinWaitActive("Blah")

HotKeySet("{ESC}", "Terminate")

Func Terminate()

Exit 0

EndFunc

While 1

Send("{Spacebar}")

sleep(8000)

Wend

Thanks again

Edited by Elite_Gamer04

Share this post


Link to post
Share on other sites

The following is what I have 'Working' at the momment, It simulates the 'Spacebar' every 8 seconds until the 'Esc' key is pressed. What do you guys think, could I be coding it better? Also if I was to Alt-Tab lets say and open my Browser, will my script continue to work even though the active window is not what the script was written for?:

1.) Coding is O.K.

2.) send() will only send messages to the active window.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Take a look at this for another example that you could hack to fit your needs:

http://www.autoitscript.com/forum/index.php?showtopic=13749


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

We Could give him the code right away... but I don't think any of us really want to put forth THAT much effort when it seems as though the person in question hasn't really looked for a way to accomplish what he wants. I've been working with AutoIT v3 for about three days now and I've been able to script huge programs that do every thing from automate certain processes to auto responding in MSN.  :whistle: So if I can do THAT in three days, I'm sure he could accomplish what he wants in a matter of minutes.

<{POST_SNAPBACK}>

I understand what you are saying Frozenyam.But if you have no experience with some other language (Qbasic e.g.) then some concepts like loops and conditional statements might be hard to grab at the start...Although AutoIt has a wonderful documentation and it is the half of its success,some points might be blank for a noob.At least he didnt ask us to write the whole code like others have not a few times done in here....Here is an fine example of what i'm referring to...And thats why most of the answers were ironic...It's a matter of approach actually....

C ya..

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