Nioku Posted July 5, 2011 Share Posted July 5, 2011 Dear Community,as you can read on the title I'm new to AutoIt and actually have an easy task. I've tried to read through certain FAQ's and guides but I'm overwhelmed by all these informations that I still can't figured it out myself. Please help me on this "easy" task.What I want to do with AutoIt:Every 23 seconds I would like to "AutoIt" the following1. Pressing V 2. Then Q followed by a right-click3. W followed by another right-click4. X5. V again.I'm pretty sure I had such a script already but I just can't find it. Please help me out on this one.Best regards,Sphirex Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 (edited) Hi and welcome. I left you a list of functions that will do the job. Sleep() - Pause script execution. Send() - Sends simulated keystrokes to the active window. MouseClick() - Perform a mouse click operation. You can search the usage of any of those functions in the help file. if you have some doub`t ask here. You can put the functions in a loop. A loop is how you refer to a section of script that you repeat a number of times. You might want to loop a given number of times or you might wish to repeat a section of script as long as a certain condition is true or false.While true ;...(Your code) Wend If you read the help file there are some tutorial there that might be useful. Like the Simple "Notepad Automation" or "WinZip installation". Also you can use Control Functions as ControlSend() and ControlClick() if you want to do this in a unactive window. EDITED: some misspelled Edited July 5, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 First of all thank you, your help is pretty decent and should help me on my task but there is an additional question, I would like to send multiple keystrokes as written in my first post. How do I seperate them, can I just repeat the Send() function as often as I want to? Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 (edited) First of all thank you, your help is pretty decent and should help me on my task but there is an additional question, I would like to send multiple keystrokes as written in my first post. How do I seperate them, can I just repeat the Send() function as often as I want to? yes you can do as often you want. you can do this way. send("CQ") ; this Send CQ you can also put a sleep between. send("C") ; this Send C only Sleep(1000) ; Waits 1000 miliseconds / 1 second Send("Q") ; Send Q Edited July 5, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 (edited) Alright that is what I have so far: send("V") send("Q") MouseClick("right") Sleep(2000) Send("W") MouseClick("right") Sleep(2000) Send("V") Sleep(23000) But somehow it keeps closing on its own, do I have to add anything or did I do something wrong. Once again thanks for your patience as I said it is my first time using AutoIt. Edited July 5, 2011 by Nioku Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 (edited) Alright that is what I have so far: send("V") send("Q") MouseClick("right") Sleep(2000) Send("W") MouseClick("right") Sleep(2000) Send("V") Sleep(23000) But somehow it keeps closing on its own, do I have to add anything or did I do something wrong. Once again thanks for your patience as I said it is my first time using AutoIt. Don`t worry we all learn somehow from these questions.. If you want to repeat the secuence, you will need to put in a loop, the loop makes that all what is inside of it, will be repeated until some condition is accomplished. While true ; everything is inside this loop will be repeated indefinitely. send("V") send("Q") MouseClick("right") Sleep(2000) Send("W") MouseClick("right") Sleep(2000) Send("V") Sleep(23000) Wend ; close the loop If you want to ask something else, just do it we are here for that EDITED: Some typing Edited July 5, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
somdcomputerguy Posted July 5, 2011 Share Posted July 5, 2011 But somehow it keeps closing on its own, do I have to add anything or did I do something wrong. Once again thanks for your patience as I said it is my first time using AutoIt.You've been pointed there once, I'll point you there again, Loop Statements. Please do yourself a favor, read thru the whole Help file. There's tutorials and other helpful links in the Wiki also. - 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...
Maffe811 Posted July 5, 2011 Share Posted July 5, 2011 [code'autoit']send("V") send("Q") MouseClick("right") Sleep(2000) Send("W") MouseClick("right") Sleep(2000) Send("V") Sleep(23000) Just remember this will end up as a 27second loop due to the Sleeps inn the middle [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 Wow thats quite simple, it actually works, thank you! But still not the way I want it to. How can I add a function that the key X is just pressed when a certain value drops below 30 for example? Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 Just remember this will end up as a 27second loop due to the Sleeps inn the middle There´s no loop there :S How can I add a function that the key X is just pressed when a certain value drops below 30 for example? Ass Statements... search in the help about If Else statement. Something like this. If $var < 30 then send("X") Endif Look the help and look the example from the help and try to figure out how to apply and use it. Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 Ok it is working now as I want it to but why does AutoIt always skip one step? The first two times the script runs just fine but on the third turn it always skip the last simulated "V". I've tried to change the pauses because I thought its depending on it but it doesn't. Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 Ok it is working now as I want it to but why does AutoIt always skip one step? The first two times the script runs just fine but on the third turn it always skip the last simulated "V". I've tried to change the pauses because I thought its depending on it but it doesn't.:S Strange. can you post your script? Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 It's the same as before just changed the intervals a bit. While true Sleep(4000) send("V") Sleep(2000) send("Q") Sleep(2000) MouseClick("right") Sleep(3000) Send("W") Sleep(2000) MouseClick("right") Sleep(3000) Send("V") Sleep(23000) Wend Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 For my it is working fine. My guess is that the problem happend when the mouse send Rightclick maybe some menu popup so the key is sended to the menu and not where you want to send it. Link to comment Share on other sites More sharing options...
Nioku Posted July 5, 2011 Author Share Posted July 5, 2011 I'm actually using it for different things but rightclicking doesn't cause a pop up though this shouldn't be the problem. I'm sure the intervals are right but still it keeps skipping certain steps after two turns. Link to comment Share on other sites More sharing options...
monoscout999 Posted July 5, 2011 Share Posted July 5, 2011 (edited) Where are yoe using the script? Maybe i can run some tests myself. Edited July 5, 2011 by monoscout999 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