Sign in to follow this  
Followers 0
miketh2005

What's wrong with my script?

3 posts in this topic

#1 ·  Posted (edited)

Hey guys, I have this script:

Edit: Fixed by yakir. Thanks.

But, I'm getting this error:

C:\Program Files\AutoIt3\Include\File.au3(47,1) : ERROR: syntax error

Func

^

C:\Users\Mike\Documents\AutoIT Scripts\VBA Bot.au3 - 1 error(s), 0 warning(s)

What happened? I can't figure it out....

Edited by miketh2005

Share this post


Link to post
Share on other sites

Hey guys, I have this script:

MouseClick("left", 1109, 1003, 1)
MouseClick("left", 974, 837, 1)


While 1 ;a simple loop, that is always on when bot = 1
    $coord = PixelSearch(146, 224, 359, 265, 0x008000)
    If @error Then ;it's better to do, if it fails first
        ContinueLoop
    Else ;Else function, meaning if that doesn't happen, then do this
        Bot()
    EndIf
WEnd

Func Bot()
    #include <File.au3>
    #include <Array.au3>
    Dim $avArray[5]

    $file1 = FileOpen("C:\AutoIt\VBA.TXT", 0) 
    $line1 = FileReadLine($file1, 2)
    $line2 = FileReadLine($file1, 3) 
    $line3 = FileReadLine($file1, 4) 
    $line4 = FileReadLine($file1, 5) 
    $line5 = FileReadLine($file1, 6) 

    MouseClick("left", 209, 1000, 1) 
    MouseClick("left", 323, 913, 1) 
    MouseClick("left", 163, 114, 1)
    MouseClick("left", 939, 886, 1)
    MouseClick("left", 408, 119, 1)
    MouseClick("left", 407, 413, 2) 
    Sleep(3000) 
    MouseClick("left", 657, 113, 1) 
    MouseClick("left", 104, 57, 1) 
    Sleep(5000)
    MouseClickDrag("left", 928, 686, 693, 684)
    Send("^c")
    MouseClick("left", 408, 119, 1)
    MouseClick("left", 758, 685, 1) 
    Send("^v")
    MouseClick("left", 163, 114, 1) 
    MouseClick("left", 506, 662, 1)
    Send("^v") 
    MouseClick("left", 131, 572, 1) 
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}")
    Send("{DOWN}") 
    Sleep(1000)
    MouseClick("left", 411, 643, 1) 
    MouseClick("left", 505, 679, 1)
    MouseClick("left", 475, 717, 1) 
    MouseClick("left", 412, 718, 1) 
    MouseClick("left", 449, 589, 1) 
    Send(0, 1)
    Send(Random(1, 9, 1), 1)
    Send(Random(10, 28, 1), 1)
    Send(19, 1)
    Send(Random(50, 90, 1), 1)
    MouseClick("left", 657, 113, 1)
    MouseClickDrag("left", 783, 745, 694, 745)
    Send("^c")
    MouseClick("left", 163, 114, 1)
    MouseClick("right", 494, 506, 1)
    MouseClick("left", 538, 624, 1) 
    MouseClick("left", 516, 466, 1)
    MouseClick("left", 501, 496, 1) 
    MouseClick("left", 657, 113, 1) 
    MouseClickDrag("left", 712, 878, 694, 879) 
    Send("^c") 
    MouseClick("left", 163, 114, 1) 
    MouseClick("left", 530, 810, 1)
    Send("^v")
    MouseClick("left", 535, 832, 1)
    Send("^v") 
    MouseClick("left", 657, 113, 1) 
    MouseClickDrag("left", 731, 878, 718, 878) 
    Send("^c") 
    MouseClick("left", 163, 114, 1) 
    MouseClick("left", 530, 810, 1) 
    Send("^v") 
    MouseClick("left", 535, 832, 1) 
    Send("^v") 
    MouseClick("left", 657, 113, 1) 
    MouseClickDrag("left", 764, 877, 737, 879) 
    Send("^c")
    MouseClick("left", 163, 114, 1)
    MouseClick("left", 530, 810, 1) 
    Send("^v") 
    MouseClick("left", 535, 832, 1) 
    Send("^v") 
    ClipPut($line1) 
    MouseClick("left", 471, 250, 1) 
    Send("^v")
    ClipPut($line2) 
    MouseClick("left", 448, 324, 1) 
    Send("^v") 
    MouseClick("left", 834, 949, 1) 
    MouseClick("left", 408, 119, 1) 
    ClipPut($line1) 
    MouseClick("left", 699, 495, 1) 
    Send("^v") 
    ClipPut($line2) 
    MouseClick("left", 915, 496, 1) 
    Send("^v") 
    ClipPut($line3) 
    MouseClick("left", 714, 558, 1) 
    Send("^v") 
    ClipPut($line4) 
    MouseClick("left", 703, 620, 1) 
    Send("^v") 
    ClipPut($line5)
    MouseClick("left", 898, 620, 1) 
    Send("^v")
    MouseClick("left", 664, 731, 1) ;Tick Terms and Conditions Box
    MouseClick("left", 929, 885, 1) 
    MouseClick("left", 163, 114, 1) 
    ClipPut($line3) 
    MouseClick("left", 523, 528, 1) 
    Send("^v") 
    ClipPut($line4)
    MouseClick("left", 509, 604, 1)
    Send("^v") 
    ClipPut($line5) 
    MouseClick("left", 492, 679, 1) 
    Send("^v") 
    MouseClick("left", 538, 640, 1) 
    MouseClick("left", 526, 667, 1) 
    MouseClick("left", 468, 754, 1) 
    MouseClick("left", 839, 835, 1) 
    _FileReadToArray("C:\AutoIt\VBA.TXT", $avArray)
    For $deletefile = 5 To 0 Step -1
        _ArrayDelete($avArray, $deletefile)
    Next
    _FileWriteFromArray("C:\AutoIt\VBA.TXT", $avArray)
EndFunc   ;==>

But, I'm getting this error:

What happened? I can't figure it out....

#include <File.au3>

#include <Array.au3>

need to be on the top of your code

Share this post


Link to post
Share on other sites

Ohhh, thanks man, can't believe I didn't see that. Must've been when I was transferring 1 part of the code to the biggest.

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