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
 Automatizing file re-import

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
LC_ Posted - 08/07/2013 : 10:57:26 AM
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.0 SR1
Operating System: Windows 7

Hi

I have a project containing several imported files. I need to re-import the files - with same file names, but stored in a different folder in the server. I am trying to automatize this task with Labtalk but so far I haven't been successful.

Trying the code below,


doc -e LB
{
impinfo t:trInfo;
string strFName$ = trInfo.Info.FileName$;
trInfo.Info.FilePath$ = "C:\" + strFName$; //example path
reimport;
}

Changing the information on FilePath node will not update the path as read by reimport function and therefore the original file will be re-imported. Is there a workaround for this or should I consider using impFile instead (if it could work)?

thanks in advance
3   L A T E S T    R E P L I E S    (Newest First)
greg Posted - 09/18/2013 : 09:08:45 AM
The "Save file info. in workbook" check box on the "Variable Extraction" page of the Import Wizard is usually checked by default, in which case you could do the following to get the name of the filter file:
impinfo ipg:=[Book6]"Trial Run 3" tr:=tr;
strFilterFile$ = tr.FilterInfo.FileName$;
strFilterFile$=;

If the sheet is the currently active sheet you can omit the ipg argument.
LC_ Posted - 09/17/2013 : 09:12:51 AM
Hi Greg

Thanks for the answer. I managed to make it work, but there is only one thing that is not ideal yet. The files are imported with filters (files from different sources have different filters) and the script will loop through all the workbooks. If the filter names were stored as the file names are, I could retrieve them and send as parameter to "impfile" command. For some reason, however, the variable FILTER in SYSTEM.IMPORT tree is empty on all my filters. Therefore when I want to change the file path I always have to select the appropriate filter from the "Select Filter" dialog.

Is there a way to save the filter name during import? I hoped it would be automatic as the other parameters in SYSTEM.IMPORT.


ps. when I don't need to change the file path, I use the reimport function in my script and the filters are called up automatically - somehow reimport knows which filter was used.

Thanks again!
greg Posted - 08/26/2013 : 09:30:22 AM
Unfortunately, Origin does not read that storage location to determine the file to reimport. Since you have the new file name, you should try the original import method, clearing the worksheet first...

impinfo t:trInfo;
string strFName$ = trInfo.Info.FileName$;
string fname$ = "C:\" + strFName$; //example path
clearworksheet %H;
impasc; // or other import function

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