torekp Posted February 26, 2009 Report Share Posted February 26, 2009 A brief Google search turns up nothing, but I can't believe this doesn't already exist. I'm looking to place a file control on my VIs, with a browse button visible. When the user browses to (for example) user.lib\Paultext.txt, the new contents of the control should BE user.lib\Paultext.txt rather than C:\Progr ... bview 8.5\user.lib\Paultext.txt. In other words it should fill with the RELATIVE path. (Relative to Labview's home path - although having additional options for "relative to what" would be nice.) Then, I can have a default value for the file which makes sense even after I upgrade to 8.6 or move to a different computer, yet also have browse-ability. If this doesn't exist yet, I'll make an Xcontrol, I guess. Quote Link to comment
LAVA 1.0 Content Posted February 26, 2009 Report Share Posted February 26, 2009 Off course there is the LabVIEW wiki on Symbolic Path. Basically a 'drive' named userlib is interpreted as c:\program files\national instruments\LabVIEW 8.6\user.lib. After browsing you should check if the file is inside a symbolic path and replace the appropriate part using the native (or OpenG) relative paths. Ton Quote Link to comment
Rolf Kalbermatter Posted February 28, 2009 Report Share Posted February 28, 2009 QUOTE (torekp @ Feb 25 2009, 03:43 PM) A brief Google search turns up nothing, but I can't believe this doesn't already exist. I'm looking to place a file control on my VIs, with a browse button visible. When the user browses to (for example) user.lib\Paultext.txt, the new contents of the control should BE user.lib\Paultext.txt rather than C:\Progr ... bview 8.5\user.lib\Paultext.txt. In other words it should fill with the RELATIVE path. (Relative to Labview's home path - although having additional options for "relative to what" would be nice.) Then, I can have a default value for the file which makes sense even after I upgrade to 8.6 or move to a different computer, yet also have browse-ability.If this doesn't exist yet, I'll make an Xcontrol, I guess. While a path can be relative in itself the browse function does not work that way directly. You could instead use a hidden control whose browse button you make visible and then monitor the Value changing and whenever it changes make the necessary absolute to relative conversion and display it in the visible path control. There would need to be some error handling if the user decided to browse outside that directory as LabVIEWs File Select dialog can be not restricted directly to a certain subpart of the file hierarchy. Such small but rather cumbersome trivialities are probably the reason the Path control does not allow browsing relative paths. Rolf Kalbermatter Quote Link to comment
Phillip Brooks Posted February 28, 2009 Report Share Posted February 28, 2009 The TestStand File Dialog has an additional 'Browse History' ring at the top. It also contains TestStand specific symbolic paths. When you select <TestStand Public Directory>, the absolute path for 'look in' is changed to the target of the symbolic path. Quote Link to comment
mje Posted February 28, 2009 Report Share Posted February 28, 2009 The problem (at least on Windows) is that some paths are shall we say, non-relativistic: they just can't be resolved relatively. Use as many ".." tokens as you wish, but they won't be able to change a drive since the Windows file system doesn't mount drives to a navigable location, and no, My Computer doesn't count, go ahead, try to navigate there in a console. Any solution you implement would need to be aware of this limitation. Quote Link to comment
torekp Posted March 15, 2009 Author Report Share Posted March 15, 2009 MJE, I don't understand the problem. I have had great success translating path info using Compare Two Paths and a few minor accessories. I'm attaching the VIs (8.5) I built on top of Compare Two Paths. Rolf, thanks for the suggestion. Quote Link to comment
torekp Posted March 23, 2009 Author Report Share Posted March 23, 2009 I followed Rolf's advice and came up with this Xcontrol. The VI example_relative_path shows how to use it. In addition to what's attached here, you need the VIs from my previous post. If you put this Xcontrol in a file-reading VI, browse to an appropriate relative location, and set the default, the path stays good when you upgrade all your VIs to the next Labview version. The State_rel_path.ctl does nothing, at this point. Maybe a future version will allow relative-to's other than Labview's home path. Quote Link to comment
torekp Posted June 7, 2013 Author Report Share Posted June 7, 2013 If you put this Xcontrol [...] Re-posting these VIs, because someone asked about them. LV 8.5.1. Since I don't have permission to attach them here, here are Dropbox links instead: https://dl.dropboxusercontent.com/u/30346948/Data_rel_path.ctl https://dl.dropboxusercontent.com/u/30346948/example_relative_path.vi https://dl.dropboxusercontent.com/u/30346948/Facade_rel_path.vi https://dl.dropboxusercontent.com/u/30346948/Init_rel_path.vi https://dl.dropboxusercontent.com/u/30346948/path_absolutely.vi https://dl.dropboxusercontent.com/u/30346948/relative_path_to_home_etc.vi https://dl.dropboxusercontent.com/u/30346948/State_rel_path.ctl https://dl.dropboxusercontent.com/u/30346948/Xctrl_rel_path.xctl Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.