11-20-2021 07:02 AM
I need to run a vi in my labview project when i open the project. Is there any possible method do this? Even is possible using scripting
Thanks
11-20-2021 10:09 AM - edited 11-20-2021 10:10 AM
Projects are for organizing code during development. Why would you want the dev environment to automatically run anything? End users shouldn't be interacting with project files.
You can set a VI to run when opened, but you need to open the VI for that to happen. Even better is to compile it to an exe.
You could theoretically do this with scripting, but you would need to open the project by opening the VI containing the scripting. There's no way to make this happen when opening a lvproj file from the explorer shell (that I wouldn't call verging on malware).
11-20-2021 10:40 AM
I agree with JimB. There is no way to even designate a VI as e.g. "toplevel" (as we had with LLB's 🙂 ).
A project is for development and you can use it to build standalone applications that run as soon as they are opened.
If you want to run a VI automatically when opened, you can do so outside the project by setting the VI properties to "run when opened". No project needed. Just double-click the VI outside the project and it will open and run automatically. (note that when you open such a VI from within the project, it will not run automatically, which is a good thing!!!
The newest LabVIEW versions also have a soft barrier, because "run when opened" can be an annoying, even dangerous thing, especially if somebody attaches such a VI here in the forum and the code is organized such that the VI cannot be stopped or does something unexpected and unwanted.
That brings us back to your questions:
You are a brand new user here and we cannot really tell from your question how to judge it. Maybe you are a new LabVIEW programmer and don't yet quite understand the subtleties of the LabVIEW environment. OTOH, maybe you are a seasoned power user with extensive LabVIEW knowledge and are looking for ways to shatter new boundaries. To clarify, please explain in detail what you are trying to achieve with all this and why you think you need it. This will help us to adjust the answers accordingly.
11-20-2021 11:39 AM - edited 11-20-2021 11:40 AM
Thanks Altenbach!
You are right I am new User on the forum but using LabVIEW since 2015. I know the facts what Jim and you explained. I posted my question after reading the much about the issue on forum. But I hope there would a way using scripting or so to accomplish this task.
Now lets discuss, why really need it. Actually, I am modifying a modularized QSM based framework for development (currently don't have the link of the original framework but can share it later). There is a template tool VI to create new Module for the framework.
So The modifications I have made require a VI (populating a polymorphic VI with VIs from each Module using scripting) to run initially when a developer open the project to make the state enqueuing VIs accessible in each module. The requirement is not for deployment but for development.
oooohhhh! Hope I have tried my best to explain the situation.
Thanks
11-20-2021 11:53 AM
Thanks for the clarification! Sorry, I don't have a solution.
11-20-2021 12:26 PM
It's OK Alten
Thanks for your Response🙂
11-21-2021 12:25 PM
I once tried to find a way to do that. It’s impossible.
11-22-2021 03:55 AM - edited 11-22-2021 03:56 AM
It's possible to open a project from a vi though. Maybe you can define a "stub" vi (with "Run when opened" activated) that makes all manipulations and then opens the right project automatically?