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
 Origin Forum
 Add x amount of columns after each imported file

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
Milchy Posted - 01/30/2024 : 03:13:30 AM
Origin 2023 (64-bit) 10.0.0.154
WIN10

Hello,

I am importing multiple ASCII files and making new columns for each new file in the same sheet.

In the option to run a script after each import, I am trying to add 5 blank columns after each imported file, and I am expecting the next file to start in its own column after the inserted ones. However my script adds only the 5 extra columns after the whole import.

I am suspecting the 5 blank columns get added, however they get populated by the subsequent file. Please guide me where is the error:

The script I am using:

wks.ncols = wks.ncols + 5;
wks.col = wks.ncols;
2   L A T E S T    R E P L I E S    (Newest First)
minimax Posted - 01/31/2024 : 04:30:16 AM
Hi Milchy,

Besides James' solution, you can make use of system variable @ISE.

This variable is used to determine if the empty column/sheet/book can be used to import.

i.e.
script after each import
if (doc.dropindex==1) tempise=@ISE; //backup the original value
wks.ncols = wks.ncols + 5;
@ISE=1;


script after all files import
@ISE=tempise;  //roll back as original
del -v tempise;
YimingChen Posted - 01/30/2024 : 09:15:03 AM
Hi,

It's not working as intended because Origin imports the new data file into a blank new column. A less-than-ideal workaround is to set the first cell of the last inserted column with a number which functions as a marker. Try the script below

wks.ncols = wks.ncols + 5;
wcol($(wks.ncols)) = Data(0,0);


We will see whether there is a need for improvement.

James

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