From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically calling vi in Windows 10

Hi All,

 

I am working on a program where I want to dynamically call a VI based on selected part number. It works on my development PC (Windows 7), but not on my Production PC (Windows 10). I've stripped it down to just calling a simple program. It runs fine on Win7, but when I run it on Win10 it doesn't work. No errors, no notifications, no anything. I've tried giving both programs full admin privileges and it doesn't help. Has anyone else seen this issue at all, or have any insight into the program. I am using LV2016 currently. 

Download All
0 Kudos
Message 1 of 11
(3,242 Views)

What, exactly, are you using as VI Path?

0 Kudos
Message 2 of 11
(3,229 Views)

It's just a control that I map to the path of the string vi (in .exe form) attached in op

0 Kudos
Message 3 of 11
(3,226 Views)

Yes, but it seems like you are using the wrong path, so I want to know the exact path you are using on each PC.

0 Kudos
Message 4 of 11
(3,223 Views)

they are both ...\Desktop\string.exe

0 Kudos
Message 5 of 11
(3,209 Views)

Well it's not going to work with an executable file.

 

I wish you would just share the full paths instead of "..."

 

Try forming your path using a property node to make sure you are forming it correctly:

 

temp.png

0 Kudos
Message 6 of 11
(3,201 Views)

So, if this doesn't work with exe files, is there a way to dynamically call exe and still pass info to each of them. Or is it just as simple as keeping my sub vi in .vi format and placing it an place where the main exe can access it?

0 Kudos
Message 7 of 11
(3,193 Views)

If the VI is in a static VI reference, the application builder automatically knows to include it in the build. Here is a slightly dated article I quickly googled with more info.

 

I've never actually cared to figure out how the file path is built up inside the exe, I just use a property node as shown above.

0 Kudos
Message 8 of 11
(3,188 Views)

gregoryj wrote:

I've never actually cared to figure out how the file path is built up inside the exe, I just use a property node as shown above.


In 2009 and higher, it is similar to a zip file with a hierarchy.  The folder hierarchy is maintained to be exactly as your development folder structure.  So relative paths to VIs that are included within the EXE will be the same.  So for those, use Current VI Path and then Build Path and Strip Path to make the paths to the VIs you want to use.

 

If the VIs are not included, then you will probably want to use Application Directory to start building your paths from.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 11
(3,175 Views)

The following scheme works just fine in Development Mode, and also (with no change) when compiled as an Executable (I'm posting the Block Diagram as a Snippet just to get a picture quickly -- this is not meant to really execute, but it certainly does ...).

 

Dynamic Calls Win 10.png

The purpose of this routine is to test 24 VISA Balances by opening and closing the VISA connection and seeing if an Error results.  A Re-entrant VI, "Verify Balance" (shown as the Purple Static VI Reference in the first For loop) takes a parameter from 1 to 24, opens a VISA connection to that VISA port, and closes it.

 

The scheme I use is to drop a Strictly-Typed (note the Star) Static VI Reference, wire it to a Property Node to get the Path, and also wire the TypeDef to the Type input of Open VI Reference.  Option 140 is "Prepare to Call and Collect" (I rarely use Call and Collect, but do here) + "Enable Simultaneous Calls on Reentrant VIs" (I call this type of VI a "Clone").

 

The first For loop starts the 24 routines, the second waits (briefly) for them to exit and keeps track of those that throw an error, which gets displayed as a Boolean array of two rows of 12 "Failure" (= Red) LEDs.

 

The important thing is this code works "as is" in Development Mode, and equally when built into an EXE, with only the Main VI (shown above) as the Startup VI, with no other VI specified.

 

Oops, I almost forgot the main point.  This code (in LabVIEW 2016, 32-bit) works on both Windows 7 (64-bit) and Windows 10 (64-bit) PCs, in both Development and Executable modes.

 

Bob Schor

0 Kudos
Message 10 of 11
(3,161 Views)