Representation of Arrays

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Representation of Arrays

Post by armsys » Sun Apr 27, 2008 8:05 am

All versions of MS as of today treat Array[1] and Array[ 1] as two different animals. Sometimes it caues confusions to inexperienced MS users. It would be nice if they'll be treated as the same thing in future.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Apr 27, 2008 12:09 pm

Variables can be created however you like. That has always been the case. "Array" variables in MacroScript aren't true arrays like you will find in "proper" programming languages. But because you can use variable names inside other variable names you can treat variables as arrays. And any format is valid:

array_1
array1
array[1]
array[ 1]
array*1
array~1
...

Do what you like. Do what works best for you. Use the format you are comfortable with.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sun Apr 27, 2008 1:07 pm

Obvious, it's my misunderstanding and ignorance. Thanks for telling these aren't true arrays. May I venture to extend the idea of creating variables on the fly? For example,
Let>Var=ReferenceVar
Let>%Var%=123
Surprisingly, Macro Schedule supports the creation of variables on the fly.
In the above test script, 123 is actually assigned to Reference!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Apr 28, 2008 1:06 am

See this thread for a more lengthy explanation.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Apr 28, 2008 2:48 am

Hi JRL,

Thank you for the valuable URL.
Thank you for sharing your in-depth insight in handling variables.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts