CZorg Posted February 28, 2009 Share Posted February 28, 2009 Hi all! I'm completely new to AutoIt. I started using it yesterday and also made my first script yesterday. It was a script that launches World of Warcraft and logs you in, no typing passwords needed any more ... But today I got an idea because the server I'm on seems to disconnect often. The idea was a script that runs in the background if World of Warcraft is opened and when I disconnect I just have to press a certain key combination and the password is filled in for me and logs in to my account. But the script I have so far gives me an WEnd error. Here's the script: ; Globals $TextFileName = "launcher.ini" $ProcessName = "wow.exe" ; Set hotkey to CTRL+ALT+R HotKeySet("^!r", "MyRetype") While 1 Func MyRetype() $FileContents = FileRead($TextFileName) Send($FileContents) Send("{ENTER}") EndFunc WEnd ; Exit if World of Warcraft is not running if Not ProcessExists($ProcessName) Then Exit EndIf I don't see what's wrong whit how I'm using the WEnd. Help me... Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 28, 2009 Share Posted February 28, 2009 You can't define functions inside loops. Move the function out of the while loop, and then put a sleep or something in the loop. Link to comment Share on other sites More sharing options...
CZorg Posted February 28, 2009 Author Share Posted February 28, 2009 Thanks! I also noticed that the end of my code didn't work ; Exit if World of Warcraft is not running if Not ProcessExists($ProcessName) Then Exit EndIf So instead of set it to sleep in the loop I made it check if wow.exe was still running. Link to comment Share on other sites More sharing options...
Richard Robertson Posted February 28, 2009 Share Posted February 28, 2009 Yes, you do want that check in the loop. I wasn't thinking about that. But also add a sleep to keep the processor from being overused. Link to comment Share on other sites More sharing options...
CZorg Posted February 28, 2009 Author Share Posted February 28, 2009 Thank you so much for your help! My AutoLogin and ReLogin scripts now works almost flawless! 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