Jump to content

Recommended Posts

Posted

Var names can be anything. As long as it does not start with the @ symbol.. Why?

MsgBox(0, "Test", Assign("@", "")); returns 0
MsgBox(0, "Test", Assign("@test", "")); returns 0
MsgBox(0, "Test", Assign("te@st", "")); returns 1
I think thats the only naming limitation. There is no built in length limit.
What do Macros start with? @ComSpec etc....

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

  • Moderators
Posted (edited)

Var names can be anything. As long as it does not start with the @ symbol.. Why?

MsgBox(0, "Test", Assign("@", "")); returns 0
MsgBox(0, "Test", Assign("@test", "")); returns 0
MsgBox(0, "Test", Assign("te@st", "")); returns 1
I think thats the only naming limitation. There is no built in length limit.
Might want to re-check that.

Edit:

I should have stated.

Vars must be any of the following characters:

a-z

A-Z

0-9

_

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

Vars can be null(Edit: ment to say "any character, even null", also I know this isn't what the help file states but it can be done.), but of course it has to be defined in Assign().

Are var names and macros evaluated in the same way? Would Eval("@ScriptName") return the script name or $@ScriptName?

...

Nope

Tests so far:

MsgBox(0, "Test", Assign("@", "")); returns 0
MsgBox(0, "Test", Assign("@test", "")); returns 0
MsgBox(0, "Test", Assign("te@st", "")); returns 1
MsgBox(0, "Test", Eval("@ScriptName")); returns ""

$msg = ""
For $i = 0 To 255
    If Not Assign(Chr($i), $i, 2) Then $msg &= $i
Next
MsgBox(0, "Test", $msg); Returns 64
Assign(Chr($i), $i, 2) sets the vars to $i because it would hit the var used in the for loop $i and reset it :\. Edited by gamerman2360

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