I am trying to send or message a value in an array

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Alpha_AI
Pro Scripter
Posts: 61
Joined: Wed Sep 19, 2007 9:30 am

I am trying to send or message a value in an array

Post by Alpha_AI » Thu Oct 04, 2007 2:47 pm

Let>NumTimesToLoop=21
Let>Counter=0
Let>Index=6
Label>StartOfLoop
//Let>B6_SIZE=4098

LibFunc>hIE,ExtractTag,r,%IE[0]%,,B,Index,0,PropertyName
MidStr>r_6,1,r,MYNAME
//Message>MYNAME
//wait>5
//.. do something
//..
Let>Properties[%Counter%] = %PropertyName%
Add>Counter,1
Add>Index,1
If>Counter=NumTimesToLoop,FinishLoop
Goto>StartOfLoop
Label>FinishLoop

Let>NumTimesToLoop=5
Let>Counter=0
Label>StartOfSecondLoop
Message>Properties[%Counter%]
//I have tried this Message>%Properties[%Counter%]%
Wait>5
Add>Counter,1
If>Counter=NumTimesToLoop,FinishSecondLoop
Goto>StartOfSecondLoop
Label>FinishSecondLoop

Hello,

I am trying to receive the value from the array given the counter value as the array index.

i tried send Properties[%Counter%] and it outputs Properties[%Counter%]
I tried message>Properties[%Counter%] and it outputs Properties[%Counter%]

I had checked the debugger and each array index of Properties contains the names of the properties. So i am wondering what is wrong?

Ben

Alpha_AI
Pro Scripter
Posts: 61
Joined: Wed Sep 19, 2007 9:30 am

Post by Alpha_AI » Thu Oct 04, 2007 2:49 pm

Oops, Change MYNAME to PropertyName.
I changed it from MYNAME to PropertyName so that it was easier for you guys to understand.

I wonder what the problem is with the code.
Ben

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

Post by Marcus Tettmar » Thu Oct 04, 2007 3:06 pm

Remove the spaces in this line:

Let>Properties[%Counter%] = %PropertyName%

Should be:

Let>Properties[%Counter%]=%PropertyName%

[Unless you are using the IGNORESPACES directive]

Next you need to do:

Let>displayit=Properties[%Counter%]
MessageModal>displayit
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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