Sign in to follow this  
Followers 0
CZorg

Help with WEnd

5 posts in this topic

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 :P...

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...

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thank you so much for your help!

My AutoLogin and ReLogin scripts now works almost flawless!

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