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
 File path name from GetN
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

abhishek.khare

United Arab Emirates
9 Posts

Posted - 07/13/2021 :  04:40:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
OriginPro 2021b (64-bit) SR1
9.8.5.204

Operating System: Windows 64bits

Hello Team,

I am using getn function to get a file name for using it further processing.

getn (Select CSV file) strMVPFile$:@BBFile;

This works fine and I can process the file data.

However, I can not get the full file name with path from strMVPFile$ string.

Can anyone help me on how to get the full file name with path in to a string? I want to use part of this file path for some label. Many thanks in advance.

YimingChen

1666 Posts

Posted - 07/13/2021 :  09:05:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Isn't strMVPFile$ returned as a full file name with path? If you want to extract path or file name separately, you may check this page:
https://www.originlab.com/doc/LabTalk/ref/String-obj#GetFileName

James

Edited by - YimingChen on 07/13/2021 09:05:40 AM
Go to Top of Page

abhishek.khare

United Arab Emirates
9 Posts

Posted - 07/13/2021 :  09:50:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply

quote:
Originally posted by YimingChen

Isn't strMVPFile$ returned as a full file name with path? If you want to extract path or file name separately, you may check this page:
https://www.originlab.com/doc/LabTalk/ref/String-obj#GetFileName

James



Thanks James for the response, much appreciated.

When I print strMVPFiles$ using "type" I dont get the full file name but only the parent drive name. When I use "type -v" I get the full path. So question is how to get the full path in to a string which I can process further. strMVPFiles$ does have a a full path but I can not get it.

~Abhishek
Go to Top of Page

YimingChen

1666 Posts

Posted - 07/13/2021 :  10:34:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Can you show me the full path full path (copy from file explorer top bar) and the path you see with "type -v"?

James
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 07/13/2021 :  7:00:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Simplest way to print a string variable is to use "=", see code below


	string str1$="a\tb";
	type str1$;
	type -v str1$;
	string str2$=str1$;
	str2$=;


type -v is to prevent converting escape characters like \t.

CP

Go to Top of Page

abhishek.khare

United Arab Emirates
9 Posts

Posted - 07/14/2021 :  08:33:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Path from explorer:
Z:\01 Data\Link 1P\example.csv

Path from type -v:
Z:\01 Data\Link 1P\example.csv

Go to Top of Page

YimingChen

1666 Posts

Posted - 07/14/2021 :  09:16:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
strMVPFile$ still contains the full path name. type command treats "\0" in the string as an escaping character. As mentioned in prvious post, you can use strMVPFile$= to check the string value. You can still get its path and file name by:

string fname$ = strMVPFile.GetFileName()$;
fname$=;
string path$ = strMVPFile.GetFilePath()$;
path$=;


James

Edited by - YimingChen on 07/14/2021 09:17:33 AM
Go to Top of Page

abhishek.khare

United Arab Emirates
9 Posts

Posted - 07/14/2021 :  09:17:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks CP for the information, appreciated it!
Go to Top of Page

abhishek.khare

United Arab Emirates
9 Posts

Posted - 07/15/2021 :  12:47:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by YimingChen

strMVPFile$ still contains the full path name. type command treats "\0" in the string as an escaping character. As mentioned in prvious post, you can use strMVPFile$= to check the string value. You can still get its path and file name by:

string fname$ = strMVPFile.GetFileName()$;
fname$=;
string path$ = strMVPFile.GetFilePath()$;
path$=;


James



Thanks James, this helps a lot. Very much appreciated!

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