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
 Renaming selected column from button script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

NicholasSupport

USA
64 Posts

Posted - 01/06/2025 :  8:23:11 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I am trying to make a button that renames the selected column.

The button executes this script:
double freq = 32.703;
wks.col.LNAME$="C1";
// Generate sine
csetvalue formula:="sin(2*pi*freq*col(A))" recalculate:=0;
// Set Sparklines
sparklines sel:=1;


Currently, when the button is triggered, column C is renamed no matter which column is selected. The sine wave data does, however, fill to the selected column.

How do I script the button to rename the column that it is filling with data?

Best,

Nicholas G.
nicholas@originlab.com
OriginLab Technical Support Team

minimax

351 Posts

Posted - 01/07/2025 :  08:54:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
wks.col does not refer to selected column.

You may try using wks.c1.


double freq = 32.703;
if (wks.c1==1)
	{type -a "cannot set col(A)";return;}
//wks.c1 refers to leftmost selected column
wks.col$(wks.c1).lname$="C1";
//provide selected col as input
csetvalue col:=$(wks.c1) formula:="sin(2*pi*freq*col(A))" recalculate:=0;
sparklines sel:=1;
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