01-07-2011 12:55 PM - edited 01-07-2011 01:01 PM
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
01-07-2011 01:03 PM
@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).
01-07-2011 01:07 PM
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
01-07-2011 01:08 PM
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.
01-07-2011 01:08 PM - edited 01-07-2011 01:12 PM
@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
01-07-2011 01:16 PM
@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?
01-07-2011 01:17 PM
Setting aside implementation for the moment, what operation are you trying to perform?
01-07-2011 01:45 PM
@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
01-07-2011 01:48 PM
Food for thought.
01-07-2011 02:18 PM
That's gold Darin. Could you please elaborate?