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
 Origin Forum
 Ìmport script-stripping file name
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

neutrondude

Brunei
Posts

Posted - 08/25/2009 :  07:24:19 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 7.5
Operating System: XP

Dear all, I want to have a script that strips the filename of the data set (under import) and only usees the last four characeters(numbers)
I have tried something like this but it doesnt work. Could you help me?

%A = page.info.system.import.filename$; // get filename
%A = %[%A,#1,.]; // strip extension
%A = %[%A,>%[%A]-4]; // strip all but last 4 characters
win -r %H %A; // rename worksheet

Laurie

USA
404 Posts

Posted - 08/25/2009 :  09:48:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Try the following:

%A = page.info.system.import.filename$; // get filename
%A = %[%A,#1,.]; // strip extension
length = %[%A]; //length of string
%A = %[%A,size-3:size]; // strip all but last 4 characters
win -r %H %A; // rename worksheet
delete -v length; //delete variable

OriginLab Technical Support
Go to Top of Page

neutrondude

Brunei
Posts

Posted - 08/25/2009 :  10:04:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot it works (after replacing "size" with "length" in the script..)!!
Go to Top of Page

Laurie

USA
404 Posts

Posted - 08/26/2009 :  10:59:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Great. Thanks for catching my mistake.

%A = page.info.system.import.filename$; // get filename
%A = %[%A,#1,.]; // strip extension
length = %[%A]; //length of string
%A = %[%A,length-3:length]; // strip all but last 4 characters
win -r %H %A; // rename worksheet
delete -v length; //delete variable

OriginLab Technical Support
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