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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 impASC (long and short names)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

OndrejMM

Australia
81 Posts

Posted - 11/10/2008 :  6:30:52 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I have a small problem, with importing,... when import via LabTalk both workbook' names are renamed after the file (i.e. long and short names),... I would need to specify that I want to "rename long name for book only", I know how to do it manually but how can I specify this option when importing by means of the Labtalk script?

In other words I would need the short names of the newly created workbooks remind unchaged, i.e. book1, book2, etc.

Cheers
Ondrej

// Point to where the data files are
string path$ = "C:\X\";
// Find all files with wild card
findfiles ext:="*.dat";
int numFiles = fname.GetNumTokens(LF);
// Loop over all files
int nFirst = 1;
for(int ifile = 1; ifile <= numFiles; ifile++)
{
string filepath$, file$;
// Get next file name
filepath$=fname.gettoken(ifile,LF)$;
// Parse out just file name without path and without extension
file$ = filepath.gettoken(filepath.getnumtokens(\),\)$;
file$ = file.gettoken(1,.)$;

newbook;
impASC fname:=filepath$;

delete_file(filepath$);
};

Deanna

China
Posts

Posted - 11/10/2008 :  8:30:38 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, OnderjMM,

We can rename only the long name by setting options.Names.FNameToBkLnOnly to 1. The options variable of the impasc X-Function is a tree to control the import options. It has a branch called Names to control target workbook naming and the node FNameToBkLnOnly is for specifying whether to rename only the workbook.

Please try the following script:


fname$=system.path.program$+"samples\signal processing\fftfilter1.dat";
impasc options.Names.FNameToBkLnOnly:=1; 


Deanna
OriginLab Technical Services
Go to Top of Page

OndrejMM

Australia
81 Posts

Posted - 11/11/2008 :  05:47:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Deanna,thanks it works! where can i find all this options? whatever I do I cannot find it in my help,... thanks,ondrej
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 11/11/2008 :  11:37:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For programming help, best to use Originlab wiki site,

http://wiki.originlab.com/~originla/wiki/index.php?title=Main_Page

For the specific ascii import options, see this in the wiki:

http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Importing_using_X-Functions

and


http://wiki.originlab.com/~originla/wiki/index.php?title=LabTalk:Data_Import#Partial_Import_with_Option_Settings

To see the listing of the options in each XF, do this

impasc -h

from the script window.


CP
Go to Top of Page

OndrejMM

Australia
81 Posts

Posted - 11/11/2008 :  4:35:03 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
this is indeed useful,...
cheers, ondrej
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 © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000