Jump to content

Help needed declaring variant


Recommended Posts

Ok, I've only just got AutoIt and have started to create a program.

However, when I try to run the program I get this error:

Line 13:

Dim $a = 0

Error: Unknown commmand.

I can't understand why it brings up an error with this...

Am I missing something that is required when declaring a variable?

All help apppreciated.

Thanks.

Edited by aydin
Link to post
Share on other sites

Ok, here's the code for it:

Dim $a = 0


; Running IE

    Run, C:\\Program Files\\Internet Explorer\\iexplore.exe
    Sleep,3000
    LeftClick, 380,100
    Send, www.website.com{ENTER}
    Sleep, 5000
    LeftClick, 200,400
    Sleep, 3000

    
; Open Window

    LeftClick, 800,400
    Sleep, 3000

    
    Do

; 1    

    LeftClick, 74,283
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 2    

    LeftClick, 74,283
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 3    

    LeftClick, 74,258
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,217
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,193
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,210
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,245
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000

    
; 4    

    LeftClick, 74,283
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 5    

    LeftClick, 74,258
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,240
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,170
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 6    

    LeftClick, 74,283
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 7    

    LeftClick, 74,258
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,170
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,218
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,260
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,268
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 8    

    LeftClick, 74,283
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 9    

    LeftClick, 74,258
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,193
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,218
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,190
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000


; 10    

    LeftClick, 74,258
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,267
    Sleep, 500
    LeftClick, 180,315
    Sleep, 500
    LeftClick, 74,170
    Sleep, 500
    LeftClick, 180,315
    Sleep, 5000

    $a = $a + 1


    Until $a = 2

    Exit

Sorry about the messy layout :lmao:

It's just a basic program that navigates through a webpage..

Edited by aydin
Link to post
Share on other sites

That is version 2.64 syntax of Autoit. That is why you are getting the error.

Edit: You may need to use Goto, if you are using v2.64. Or convert your script to v3.1, if you have Autoit v3.1.

Edited by MHz
Link to post
Share on other sites

After installing AutoIt 3 and changing most of my code it worked fine. Thanks again.

[Edit]

Does anyone know if a program can be left running.. allowing me to use the mouse to do something else? I've got a feeling this is impossible :lmao:

Edited by aydin
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...