The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 import ASCII File
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sebbey

Germany
70 Posts

Posted - 05/16/2012 :  08:40:39 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.6.0G
Operating System: Windows 7 Professional

Hi everyone,

my LabTalk scripts run with a customized toolbar button. The first thing that happens after clicking on the button is this:

impAsc -d;


The ImportASC window pops up and I can select a file to import. If I choose more than one file to Import, all the files are imported into one workbook. Is there a way to import several files into several workbooks, without having to open several ImportASC windows. It would be perfect if I could click the button once, select all the files I need and import all these files in seperate workbooks.

And I have another question. Is it possible to somehow save the settings I need. Maybe within a LabTalk script. The script I'm currently working on will be used by many people who shouldn't be able to change any of these settings, in order for the script to work properly.

Thank you for your help,
sebbey

greg

USA
1231 Posts

Posted - 05/16/2012 :  4:10:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Here is a basic script to import user-selected files into new workbooks:

// Prompt for files
dlgfile group:=ASCII multi:=1 init:=%Y; // %Y is your UFF
// Loop over all the files
loop(ii,1,fname.GetNumTokens(CRLF))
{
// Get the next file
file$ = fname.GetToken(ii,CRLF)$;
impasc file$;
// If we are not done, add a new book
if(ii < fname.GetNumTokens(CRLF)) newbook;
}

There are many places script can be stored and run in Origin, but the two most common would be in a menu or a toolbar. For example, you can use the Custom Menu Organizer found under the Tools menu to add new menus with custom script.
Go to Top of Page

sebbey

Germany
70 Posts

Posted - 05/21/2012 :  02:38:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
hi greg,

thanks for your answer. the script works perfectly and does exactly what i wanted!!

sebbey
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2008 Originlab Corporation Go To Top Of Page
Snitz Forums 2000