LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strip path multiple times

I use the function Current VI's path and then pass the value to strip path. I know I need to go up three levels but putting multiple strip paths end to end yields the same path each time. Surely there is a better way than converting to a string searching and splitting and repathing, if that is doable.

 

Thanks,

 

jvh

0 Kudos
Message 1 of 25
(5,746 Views)

 


@jvh75021 wrote:

... but putting multiple strip paths end to end yields the same path each time.


I don't understand what you mean by this.

 

 

What are you trying to accomplish with the Strip Path. What are you trying to get the path to? Another way you can do it is to convert the path to an array of strings (Path to Array of Strings), chop off what you need, and then convert back to a path (Array of Strings to Path).

0 Kudos
Message 2 of 25
(5,734 Views)

Try "Path to Array of Strings" function.

Then use "Array Subset" the get the part you need and then "Array of Strings to Path" to get it back to a usable path.

 

Not sure if it is a better way

Omar
0 Kudos
Message 3 of 25
(5,728 Views)

 



I don't understand what you mean by this.

 

 

What are you trying to accomplish with the Strip Path. What are you trying to get the path to? Another way you can do it is to convert the path to an array of strings (Path to Array of Strings), chop off what you need, and then convert back to a path (Array of Strings to Path).


 

Given path a\b\c\d\my.vi:

Strip once: a\b\c\d

strip again a\b\c

strip again a\b

 

Converting to string, string b4 match, and convert to path is what I am doing. It's just cloogy looking.

0 Kudos
Message 4 of 25
(5,727 Views)

 


@Omar II wrote:

Try "Path to Array of Strings" function.

Then use "Array Subset" the get the part you need and then "Array of Strings to Path" to get it back to a usable path.

 

Not sure if it is a better way


 

Thanks. Your way is mo betta than mine, maybe. But matching the directory  name seems easier than calculating where to stop the array subset.But I am no array expert. Final path is longer on my development system due to SCM.

 

jvh

0 Kudos
Message 5 of 25
(5,722 Views)

 


@jvh75021 wrote:

 

 

Given path a\b\c\d\my.vi:

Strip once: a\b\c\d

strip again a\b\c

strip again a\b

 

Converting to string, string b4 match, and convert to path is what I am doing. It's just cloogy looking.


Could you repeat this, in English? What does "string, string b4 match, and convert to path" mean? What's being converted to strings, and what does "string b4 match" mean?

 

0 Kudos
Message 6 of 25
(5,704 Views)

Setting aside implementation for the moment, what operation are you trying to perform? 

Message 7 of 25
(5,703 Views)

 


@Darin.K wrote:

Setting aside implementation for the moment, what operation are you trying to perform? 


 

It is done already. 

 

I am executing a VI in C:. .../mainVI_Dir/Transmitter/Private. I need to access an ini file in mainVI_DIR and wish to do it with relative addressing as mainVI_DIR has a longer path on my development system than the deployment systems.So I wanted to go from 

 

C:. .../mainVI_Dir/Transmitter/Private

 

to

 

C:. .../mainVI_Dir

 

 

 

I see now that I have used forward slashes, beg your pardon, I have spent most of my career on Unix/Linux systems (and **bleep** glad of it).

 

 

Regards,

 

jvh

0 Kudos
Message 8 of 25
(5,682 Views)

Food for thought.

 

RelativePaths.png

Message 9 of 25
(5,678 Views)

That's gold Darin. Could you please elaborate?

---------------------------------
[will work for kudos]
0 Kudos
Message 10 of 25
(5,659 Views)