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
 Labtalk and Columns moving
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cheyenne

Italy
Posts

Posted - 01/30/2005 :  1:12:45 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: Win XP

I spent the whole afternoon trying to write down a labtalk script that moves columns (dataset,labels and names) leftwards and rightwards, in the same way the column toolbar buttons do, but I couldn't make it...
I'm desperate..this is part of a bigger script I'm writing in order to manipulate a complex worksheet produced by the experimental setup used in the lab. Besides, do you know how to access the code behind all the toolbar buttons and menu commands (labtalk or/and Origin.c)?
I hope somebody can help me...I'm sure there must me a way to do it, simply I didn't get it!...

Mike Buess

USA
3037 Posts

Posted - 01/30/2005 :  1:50:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
...a labtalk script that moves columns (dataset,labels and names) leftwards and rightwards
There's no LabTalk command for that but in Origin C you can use Worksheet::MoveColumns.
quote:
do you know how to access the code behind all the toolbar buttons and menu commands (labtalk or/and Origin.c)?
http://www.nmrtools.com/labtalk/i_menu.html

Mike Buess
Origin WebRing Member
Go to Top of Page

cheyenne

Italy
Posts

Posted - 01/31/2005 :  03:06:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much Mike, I'll have a look at the Origin C manual then, although i'm a real beginner with it!...
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/31/2005 :  07:37:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It turns out that the MoveColumns function doesn't work in Origin 7.5 even though it appears in the Programming guide. So the only way to move columns now is by executing the appropriate menu command. If you checked the link I gave you then you can find out that the menu ID for the Move Column to First command is 38772. Therefore, to move the fourth column to first you can do this...

wks.colsel(4,1);
menu -e 38772;

Mike Buess
Origin WebRing Member
Go to Top of Page

razva

Germany
Posts

Posted - 06/26/2007 :  2:19:15 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Although it is too late to reply to this, I am posting the script I have written to move columns in the worksheet, together with the labels and values. Maybe it will be useful for people searching the archives like I have done.

The script is manipulating the columns to arrange them in the reverse order into worksheet i.e. columns A to Z will be re-arranged Z to A. Additionally, one can keep the first column fixed as this is in general storing the independent variable. It goes like this:


aa=wks.ncols; // read the total number od columns in the active woks
//type $(aa); // check how many columns u have in the worksheet
for(ii=aa-1; ii>1; ii--) // make the variable to decrease
{
wks.colsel($(ii),1); // select columns one by one starting with the aa-1 (if aa-th column should be in front,
//all the others will have to move relative to this one)
// ii==2 or ii>1 is the condition to stop before applying the script to the first column in the wks
menu -e 38773 ; // this is the menu command to move a selected column to the end of wks
wks.colsel($(aa),0); // unselect the column that was just moved to be able to select a new one at the next iteration
}
// apply the script twice to undo the operation




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