The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 variable text
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

coll@inia.

Spain
125 Posts

Posted - 03/28/2012 :  06:17:33 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver.8.5 and Service Release (Select Help-->About Origin):
Operating System:win7

I am trying to put color black to all 100 text objects in a drawing with Labtalk.
I used the following string but the final tt$.color=1 does not recognize the text+ii variable despite typing it correctly.

Why it does not work?

for(ii=1;ii<100;ii++) {aa$="text"; bb$=$(ii); tt$= aa$+bb$; type -c tt$; tt$.color=1}

Thank you , Dr.coll

Drbobshepherd

USA
Posts

Posted - 03/28/2012 :  09:42:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Could be your command does not work because you failed to end it. Try putting a semicolon after the "tt$.color=1" and your LabTalk code might run.
Go to Top of Page

Drbobshepherd

USA
Posts

Posted - 03/28/2012 :  09:50:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Also, the LabTalk interpreter may be reading tt$ literally as "tt$" and not "text1" as you desire. In these cases, I find the string register variables (e.g. %A, %B, %J, ...) very useful.

I hope this helps.
Go to Top of Page

coll@inia.

Spain
125 Posts

Posted - 03/28/2012 :  10:34:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for the help!!,

I got it to work with both of your suggested changes ; and %. Here is the resulting "good" script:
for(ii=1;ii<100;ii++) {aa$="text"; bb$=$(ii); tt$= aa$+bb$; ifn!%(tt$).color=1;}

MANY THANKS again, julio
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000