Sign in to follow this  
Followers 0
aGorilla

How can I declare a Global Const Array?

5 posts in this topic

How do I convert the following to a constant?

Global $FILESET[4]
$FILESET[0]="connect.ini"
$FILESET[1]="folder1.ico"
$FILESET[2]="folder2.ico"
$FILESET[3]="folder3.ico"

While I'm here... is there a 'style guideline' for AutoIt code?

Share this post


Link to post
Share on other sites



I'm not very good with arrays, but I belive you can use:

Global Const $FileSet["connect.ini", "folder1.ico", "folder2.ico", "folder3.ico"]

If this doesn't work sorry, but im not sure 100% of the syntax for that. :D Hope it helps!

I was hoping it would be something like that, but that gives me the same error that all of my other attempts led to...

Error: Array variable subscript badly formatted.

Thanks much for trying though.

Share this post


Link to post
Share on other sites

Global Const $FileSet[4] = ["connect.ini", "folder1.ico", "folder2.ico", "folder3.ico"]

Tried and tested.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Aha, Sorry Kenton, I knew I was missing something!

I deleted my post so it incase others see it, they don't get the wrong info!

Edited by Swift

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

After a few more tries, I figured it out.

Global Const $FILESET[4]=["connect.ini","folder1.ico","folder2.ico","folder3.ico"]

Make sure the dimension covers the number of values, or more. Oddly enough, it's not 0-based, even though array access is.

Edit: and KentonBomb confirms it - should have reloaded before posting.

Edited by aGorilla

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