| T O P I C R E V I E W |
| tib |
Posted - 10/24/2003 : 1:10:31 PM That's the way you usually import multiple files
if(fdlog.MultiOpen()!=0/0) { loop(aaa,1,fdlog.Multiopen.count) { fdlog.get(A,aaa); win -t wks Origin; // open new template; open -w %A; // import data; }; };
If a worksheet already exists Origin gives an error message "Name already used... please enter a new name" and forces you to enter a new name. But if I want to re-import or overwrite the data how do I do this with LabTalk???
You could check for the window before importing but for this you need the worksheet name (usually =filename) In the upper case %A consists of Path+Filename+Extension. Is there a convenient LabTalk function to split %A into these three parts? Something like fdlog.path$, fdlog.name$, fdlog.ext$ ??? Thanks, Tilman.
PS. Did you know that for example fdlog.path$ would result in c:\data\new whereas %X would give you c:\data\new\ The backslash will make things even more inconsequent.
|
| 4 L A T E S T R E P L I E S (Newest First) |
| tib |
Posted - 10/25/2003 : 08:33:38 AM Ok, let's wait for V7.5 documentation But to be honest I would have expected fdlog.get(A,1,0); // the full string fdlog.get(A,1,1); // the path including "\" fdlog.get(A,1,2); // the filename without extension fdlog.get(A,1,3); // the extension But anyway it works, so I shouldn't complain... Tilman.
|
| Mike Buess |
Posted - 10/24/2003 : 9:37:47 PM I'm pretty sure that fdlog.get(A,n,m) was introduced in one of the later 7.0 SRs, probably SR4. I'd look for the documentation in 7.5.
Mike Buess Origin WebRing Member |
| tib |
Posted - 10/24/2003 : 8:49:00 PM Hi Mike, thanks a lot!
For completeness you have to add to the first issue:
fdlog.MultiOpen(); fdlog.get(A,1,1); // %A = file name without extension; if (exist(%A)==2) { // check if wks with filename exist already; win -r %A junk; // rename; win -a junk; // needs to be activated; } else { win -t data Template; // new template }; open -w %A;
Your second suggestion works perfect. Thanks! I have the suspicion that there are a lot of features not properly documented in Origin... However, trial an error is very time consuming. So please, dear Origin developers, update the help files! See also my request for complete documentation on layer.cmap...
|
| Mike Buess |
Posted - 10/24/2003 : 5:48:02 PM Hi Tilman
quote: But if I want to re-import or overwrite the data how do I do this with LabTalk???
win -r %H junk; // rename worksheet open -w %A;
quote: Is there a convenient LabTalk function to split %A into these three parts? Something like fdlog.path$, fdlog.name$, fdlog.ext$ ???
This isn't documented in 7.0, but I just tried there and it works.
fdlog.MultiOpen(); fdlog.get(A,1,0); // %A = full path\name of 1st file fdlog.get(A,1,1); // %A = file name without extension fdlog.get(A,1,2); // %A = file extension only %B=fdlog.path$; // file path (yes, oddly enough w/o trailing '\')
Hope that helps.
Mike Buess Origin WebRing Member |
|
|