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
 Origin Forum
 Setting text color via scrpit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

zknauss

USA
72 Posts

Posted - 02/15/2023 :  10:44:20 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm trying to set the color of text depending on the text components for example:

if(wcol(i)[3]==↑,ColorText(wcol(i)[3],red)

use of the colortext function isn't exactly clear in the origin C manual https://www.originlab.com/doc/en/OriginC/ref/ColorText-ColorText

An alternative option would be to color the text at the point its being generated:

wcol(i)[3]$ =
if(cc[1]>0.01&&cc[1]>=bb[1]&&cc[2]<=bb,↑,

but I'm not sure how to make the output colored

Thanks,

-Zack

ZTK

Edited by - zknauss on 02/15/2023 10:45:58 AM

zknauss

USA
72 Posts

Posted - 02/15/2023 :  12:54:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
So looking closer at the problem I need to be able to color code the symbols within each cell as detailed in Image 1 so that uppon graphing it give an output like in image 2.


ZTK
Go to Top of Page

YimingChen

1596 Posts

Posted - 02/16/2023 :  09:27:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The OC object method cannot be used in Labtalk script. However, you can try using the following script to set colored text to cells. Please note that the first three lines of the script are used to set the worksheet cells to be rich text.


wproperties execute:=get iotrgui:=tr; 
tr.TextControl.OriginTextControl=1; 
wproperties execute:=set iotrgui:=tr;
col(A)[1]$ = "\c2(A)-\c3(↑)-\c4(↓)";


James
Go to Top of Page

zknauss

USA
72 Posts

Posted - 02/16/2023 :  09:59:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Awesome I'll give it a try just wondering is there a link or way get the code for specific colors?

ZTK
Go to Top of Page

YimingChen

1596 Posts

Posted - 02/16/2023 :  10:14:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can set the text color in the worksheet cell first, then copy the cell and paste it into the script window. It should give the internal code for the color.

Go to Top of Page

YimingChen

1596 Posts

Posted - 02/16/2023 :  11:04:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
If you know the RGB value of the color, you can get the color code by the function color(), e.g. color(20.50.90)=
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