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
 Selected column in 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

shedo

Japan
2 Posts

Posted - 06/30/2021 :  02:24:25 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi there.
I wanted to copy the comments of the selected column, and paste it as the name of a new sheet in a different workbook.

However, I could not figure out how to do this on a Labtalk script.

Sorry for the noob question, but I am new to this.
Thank you :)



Edited by - shedo on 07/01/2021 01:17:43 AM

Chris D

428 Posts

Posted - 06/30/2021 :  12:12:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You may adapt this. It is one way to do it.

// Book1 1 is active
string comm$;
for (int ii = 1; ii <= wks.ncols; ii++)
{
    if (wks.isColSel(ii))
    {
        comm$ = wcol(ii)[C]$;
        break;
    }
}
if (comm.GetLength() > 0)
{
    // Activate Book2
    win -a Book2;
    wks.name$ = comm$;
}



Thanks,
Chris Drozdowski
Originlab Technical Support
Go to Top of Page

shedo

Japan
2 Posts

Posted - 07/01/2021 :  01:21:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi there Chris D.

Thank you for the solution!
I understood now. It seems that there is no code to directly manipulate where the column is selected.
So we have to check which code is currently active one by one and take the index out yeah?
This is a nice workaround.

Thanks!!



quote:
Originally posted by Chris D

You may adapt this. It is one way to do it.

// Book1 1 is active
string comm$;
for (int ii = 1; ii <= wks.ncols; ii++)
{
    if (wks.isColSel(ii))
    {
        comm$ = wcol(ii)[C]$;
        break;
    }
}
if (comm.GetLength() > 0)
{
    // Activate Book2
    win -a Book2;
    wks.name$ = comm$;
}



Thanks,
Chris Drozdowski
Originlab Technical Support


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