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
 New XYYY tables according to file name

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
Clairekun Posted - 10/01/2013 : 06:40:28 AM
Origin Ver. and Service Release (Select Help-->About Origin): 9 SR2
Operating System: Windows 7

Hello, I would like to know if there's a script for what I need. I would need a script to open files (in the same folder) with similar file name into an XYYY table, for example:

ABC_1.asc
ABC_2.asc
DEF_1.asc
DEF_2.asc
DEF_3.asc
GHIa.asc
GHIb.asc
JKL.asc

So, I would like to have 4 different tables: ABC files, DEF files, GHI files and the JKL file, in XYYY format. Please note that not all of them have an underscore to separate them, although I believe I could change that if needed, but all of them do have the first 3 characters unchanged.

I would like to avoid, if possible, writing the names manually; I mean, the script would have to be something along the lines of "files with identical 3 starting characters should be in the same table"

I currently know how to open all files in a folder, both XY and XYYY format, I think I would only need a script to determine that bit about names.

Again, I do not know if such an specific script can exist.

Thank you and sorry for the long post.
1   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 10/01/2013 : 5:30:13 PM
Maybe this will work the way you want?

dlgfile gr:=*.asc mu:=1;
loop(ii,1,fname.GetNumTokens(CRLF))
{
strFile$ = fname.GetToken(ii,CRLF)$;
strPart$ = strFile.GetFileName()$;
strPart$ = strPart.Left(3)$;
if(exist(%(strPart$))==2)
{
win -a %(strPart$);
newsheet;
impasc fname:=strFile$ options.FileStruct.NumericSeparator:=0 options.Names.FNameToBk:=0;
}
else
{
newbook name:=%(strPart$) option:=lsname;
impasc fname:=%(strFile$) options.FileStruct.NumericSeparator:=0 options.Names.FNameToBk:=0;
}
}

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