Ravel Posted December 29, 2005 Share Posted December 29, 2005 I am not completely familier with all of the autoit script commands, and how to get them to work together, but I have a script here that I would like to repeat indefinitly until I press a Hot key such as ESC. Can you all review the script below and tell me what is wrong... right now it just states that the first line is not a valid command. Thanks. HotKeySet("{ESC}", "Terminate") WinWaitActive, SimCity 4 Sleep, 100 start: WinActivate, SimCity 4 Send, ^x Sleep, 100 Send, weaknesspays {ENTER} Sleep, 100 goto, start Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
LxP Posted December 29, 2005 Share Posted December 29, 2005 (edited) Welcome to the forums!Some of this script is in AutoIt v2 syntax. This should do it for you:HotkeySet('{ESC}', 'Terminate') WinWaitActive('SimCity 4') While 1 WinActivate('SimCity 4') Send('^x') Sleep(100) Send('weaknesspays{ENTER}') Sleep(100) WEnd Func Terminate() Exit EndFuncEdit: Note that this script needs AutoIt v3 to run. While 1..WEnd invokes an infinite loop, broken by the Terminate() function when you press ESC. Edited December 29, 2005 by LxP Link to comment Share on other sites More sharing options...
Ravel Posted December 29, 2005 Author Share Posted December 29, 2005 Welcome to the forums! Some of this script is in AutoIt v2 syntax. This should do it for you: HotkeySet('{ESC}', 'Terminate') WinWaitActive('SimCity 4') While 1 WinActivate('SimCity 4') Send('^x') Sleep(100) Send('weaknesspays{ENTER}') Sleep(100) WEnd Func Terminate() Exit EndFunc Edit: Note that this script needs AutoIt v3. to run. While 1..WEnd invokes an infinite loop, broken by the Terminate() function when you press ESC. Ok thanks. Would this work in version 3? I just downloaded it because I noticed that I was in the v3 forum. Link to comment Share on other sites More sharing options...
LxP Posted December 29, 2005 Share Posted December 29, 2005 Yes, the script is written for AutoIt v3. What I meant by my initial remark was that your script was partially written in v2 and v3 syntax which is why it wasn't working for you.If you are new to learning AutoIt then v3 is a better choice anyway since it has a more standardised syntax, tidier code and better possibilities. Link to comment Share on other sites More sharing options...
Ravel Posted December 29, 2005 Author Share Posted December 29, 2005 (edited) Yes, the script is written for AutoIt v3. What I meant by my initial remark was that your script was partially written in v2 and v3 syntax which is why it wasn't working for you.If you are new to learning AutoIt then v3 is a better choice anyway since it has a more standardised syntax, tidier code and better possibilities.That did it...THANKS!!! I had a time trying to figure out what was going wrong. Oh yea thanks for having me on the boards. Glad to be apart of them. Edited December 29, 2005 by Ravel 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