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
 File path name from GetN

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
abhishek.khare Posted - 07/13/2021 : 04:40:28 AM
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.
8   L A T E S T    R E P L I E S    (Newest First)
abhishek.khare Posted - 07/15/2021 : 12:47:35 AM
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!

abhishek.khare Posted - 07/14/2021 : 09:17:01 AM
Thanks CP for the information, appreciated it!
YimingChen Posted - 07/14/2021 : 09:16:18 AM
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
abhishek.khare Posted - 07/14/2021 : 08:33:43 AM
Path from explorer:
Z:\01 Data\Link 1P\example.csv

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

cpyang Posted - 07/13/2021 : 7:00:09 PM
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

YimingChen Posted - 07/13/2021 : 10:34:37 AM
Can you show me the full path full path (copy from file explorer top bar) and the path you see with "type -v"?

James
abhishek.khare Posted - 07/13/2021 : 09:50:40 AM

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
YimingChen Posted - 07/13/2021 : 09:05:25 AM
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

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