%%k%%

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

%%k%%

Post by CatBreath » Fri Jul 08, 2005 6:20 pm

let me start by showing an example of what im trying to do:

Let>VAREXPLICIT=1
let>1=what i want
Let>k=1
Message>%%k%%

obviously its not that simple.
k gets many numerical values (and has to get numerical values only!!!) and i want the message to display the vlaue of each value (i want the message to display 'what i want').
the thing is that i get a message saying '%%k%%' instead of 'what i want'.
so can anyone tell me of a different way of writing the message?
or a different way altogether?

Thanks!

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

Post by JRL » Fri Jul 08, 2005 6:32 pm

If I'm understanding correctly you want something like this:

//leaving out VAREXPLICIT=1
Let>k=1
Let>var_%k%=what i want
Let>message_text=var_%k%
Message>%message_text%

Hope this helps,
Dick

CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

Post by CatBreath » Fri Jul 08, 2005 6:51 pm

thanks for the reply dick it made me understand that i need to elaborate what im trying to do by a better example:

Let>VAREXPLICIT=1
Let>1=nameA
Let>2=nameB
Let>3=nameC
Let>k=1
Label>again
Message>%%k%%
Let>k=%k%+1
If>k=3,end
ENDIF
Goto>again
Label>end

In the real script i have 1181 names instead of 3 so i defined them in a loop. in order to define them in the loop i needed to number them and thats how i got this mess.

anyway i want to message to display the names.

Thanks!

Luciano
Junior Coder
Posts: 31
Joined: Fri Feb 11, 2005 1:10 pm
Location: Ghent, BELGIUM

Post by Luciano » Fri Jul 08, 2005 7:26 pm

Try to use an array variable. Your example looks than as follow:

Let>name[1]=nameA
Let>name[2]=nameB
Let>name[3]=nameC

Let>k=0
Label>again
Let>k=k+1
Message>name[%k%]
wait>1
If>k=3,end,again

Label>end


Success

Luciano

CatBreath
Junior Coder
Posts: 32
Joined: Fri Jul 08, 2005 6:12 pm

Post by CatBreath » Fri Jul 08, 2005 8:16 pm

Success indeed!
oh thank you thank thank you!

im such an idiot for not realising that the problem was that i defined the same variable for two different things!

Thanks!!!

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