03-26-2024 06:54 PM
A common task is to generate a path to a file (e.g. ini) that is located right next to the VI or exe.
Here are two possibilities, the top one was seen here.
Top:
Bottom:
03-27-2024 01:38 AM
@altenbach wrote:
A common task is to generate a path to a file (e.g. ini) that is located right next to the VI or exe.
Here are two possibilities, the top one was seen here.
Top:
- Hard to debug and reconstruct from memory in the future.
- Breaks after building exe
- Breaks on any other OS.
Bottom:
- just works!
These two methods are "the same" as long as VI opened stand alone, or located in the same directory as project. When opened within project and locations of the project and VI are different, they are not the same any longer. Its because if you call this VI from the development environment and the VI is loaded in a LabVIEW project file, then Application Directory VI returns the path to the folder containing the project file, not the VI:
In additional, for many users, who coming to LabVIEW from text-based languages is still more easy to use RegExps or Formula Nodes in graphical environment. Especially in this case could be easily modified to get it running within exe as well. Nothing principal wrong with this, although NI recommend other method how to Access a VI's Current Directory.
03-27-2024 01:57 AM - edited 03-27-2024 02:03 AM
@Andrey_Dmitriev wrote:
@altenbach wrote:
A common task is to generate a path to a file (e.g. ini) that is located right next to the VI or exe.
Here are two possibilities, the top one was seen here.
Top:
- Hard to debug and reconstruct from memory in the future.
- Breaks after building exe
- Breaks on any other OS.
Bottom:
- just works!
These two methods are "the same" as long as VI opened stand alone, or located in the same directory as project. When opened within project and locations of the project and VI are different, they are not the same any longer. Its because if you call this VI from the development environment and the VI is loaded in a LabVIEW project file, then Application Directory VI returns the path to the folder containing the project file, not the VI:
In additional, for many users, who coming to LabVIEW from text-based languages is still more easy to use RegExps or Formula Nodes in graphical environment. Especially in this case could be easily modified to get it running within exe as well. Nothing principal wrong with this, although NI recommend other method how to Access a VI's Current Directory.
While that is mostly true, if you use projects you really should not tie configuration files into a subfolder of your project tree. If you intend to have your ini file located along the exe file (since Windows 7 only valid if it is not written from the app) then it would be the most logic place to store it in fhe project directory.
You don’t determine the path of your C or C# file to use as base of your configuration files either!!!
And if you need to also write to the file it should be stored in the Public or User Preferences.
Also, string manipulations on paths are a bad practice even in a C, C# or Python app, so no need to not suggest correcting them in a LabVIEW code!
03-27-2024 06:28 AM
I contend this is the true equivalent de-rube'd version.
03-27-2024 06:40 AM
@paulmw wrote:
I contend this is the true equivalent de-rube'd version.
As a direct replacement, that is correct. But, as at least alluded to (I only quickly skimmed the previous few posts), configuration files really need to be relative to the executable/project.
04-01-2024 10:00 AM - edited 04-01-2024 10:03 AM
If autoindexing never existed, we probably would need to do somethings as follows (top of image, seen here ).
(It is puzzling that the OP has partial knowledge about more advanced concepts, such as the feedback node, but missed the class about autoindexing)
04-01-2024 10:12 AM
@altenbach wrote:
(It is puzzling that the OP has partial knowledge about more advanced concepts, such as the feedback node, but missed the class about autoindexing)
I think LabVIEW defaults to insert a feedback node on circular wiring. So I doubt the OP actually knows about feedback nodes, but rather stumbled upon it.
04-01-2024 10:28 AM - edited 04-01-2024 10:43 AM
@crossrulz wrote:
@altenbach wrote:
(It is puzzling that the OP has partial knowledge about more advanced concepts, such as the feedback node, but missed the class about autoindexing)
I think LabVIEW defaults to insert a feedback node on circular wiring. So I doubt the OP actually knows about feedback nodes, but rather stumbled upon it.
Actually, upon further research, it seems they've been (ab)using feedback nodes for over three months already.. 😄
04-02-2024 01:59 AM
The amount of times a feedback node was created when i wanted it is pretty low.
The amount of times a feedback node was created when i absolutely didn't want one is too damn high.
04-02-2024 02:30 AM
@altenbach a écrit :
If autoindexing never existed, we probably would need to do somethings as follows (top of image, seen here ).
(It is puzzling that the OP has partial knowledge about more advanced concepts, such as the feedback node, but missed the class about autoindexing)
Yet the OP should know about autoindexing, since a FOR loop automatically creates one when you input an array... So that means that they've disabled it on purpose 🤔