Jump to content
Sign in to follow this  
skylark

Why do I get a "missing separator character after keyword" error?

Recommended Posts

skylark

I've searched through the AutoIt help file, and I've searched through this forum without finding an answer.

Please could someone tell me why I get a "missing seperator character after keyword" error in the line below?

for position = ( 0 + stub ) to seglength step gap

What is the key word, and what would the missing character be? I spaced out the text with spaces around the = and + and (), still get the error.

This is the first ever piece of coding I've done with AutoIt; previously I would use GWBasic.

The line above is part of an algorithmn I am trying to create/test, the full text of what I typed into the editor is appended below. Thanks

stub = 0

seglength = 24

gap = 5

for position = ( 0 + stub ) to seglength step gap

; dosomething

stub = seglength - position

next position

MsgBox(0, "stub", stub)

Share this post


Link to post
Share on other sites
Richard Robertson

Variables in AutoIt need a $ symbol on the front of the names.

$stub, $seglength, $gap, $position, etc.

Share this post


Link to post
Share on other sites
skylark

Thanks.

That is a disapointment - it requires a lot of extra typing and hassle.

GWBasic would I presume deduce that if something was not a keyword then it must be a variable - why does not AutoIt do the same? The editor seems to have no problems doing this.

I also see that it will not let me write "next $position" but only "next" - which could cause confusion with nested nexts.

Edited by skylark

Share this post


Link to post
Share on other sites
Richard Robertson

AutoIt was originally written as a VERY simple language. $ on a variable makes the parser simpler.

Share this post


Link to post
Share on other sites
skylark

Thanks.

Would it be possible to get the editor to add the $s before saving the script I wonder?

Share this post


Link to post
Share on other sites
Richard Robertson

Nope. The editor would have no way of knowing what you wanted to be a variable and what is a typo.

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  

×