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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Delete columns in a project

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
bbb208 Posted - 12/19/2014 : 6:22:19 PM
Hi everyone,

I have 50 workbooks in a origin project, I need delete 10 (e.g. 1, 5, 10...) columns of each workbook. Does anybody know how to do this with Labtalk or Origin C?

Thanks a lot
1   L A T E S T    R E P L I E S    (Newest First)
cdrozdowski111 Posted - 12/19/2014 : 8:36:40 PM
Hi bbb208,

Based on the information you provide - "(e.g. 1, 5, 10...)", the columns you want to delete do not follow a regular interval, so you can get what you want by modifying the following simple LabTalk script.

The script loops through every single worksheet in your whole project and deletes the columns specified by their index in the "delete col(#);" LabTalk commands.

1) Make a copy of your project file for backup.
2) Open the Script Window.
3) From the Script Window Edit menu, set the execution to "None".
4) Copy and paste the below script into the window.
5) Add/remove/modify as many "delete col(#)" commands as you need. (Heed comments in script!!!)
6) From the Edit menu, set the execution to "LabTalk".
7) Select/highlight all the script and press the Enter key on your keyboard. The script will run.


// Loop through all worksheets in entire project
doc -e LB {

	// Delete columns by column index (indices start at 1 from left to right)
	// BUT, you MUST delete from highest index to lowest (delete from right to left)

	delete col(10);
	delete col(5);
	delete col(1);
}


For more information abotu looping through obejcts in your project, see:
http://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs#Looping_over_Workbooks_and_Worksheets
http://www.originlab.com/doc/LabTalk/ref/Document-cmd#-e_object_.7Bscript.7D.3B_Execute_the_given_script_for_all_objects

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000