LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing an executable using VI server

Solved!
Go to solution

I am trying to access a control named "number" in the VI "Test123.vi" using the VI Server. To do this I have designed a VI named “Accessing Test123.vi".
"Accessing Test123.vi" is working fine and it allows me to access the control “number” in the “Test123.vi”.
But when I build an EXE of "Test123.vi" and when I try to access this “Test123.EXE” from the Open VI Reference function, it gives me an error: "Error 1004 occurred at Open VI Reference in Accessing Test123.vi".
After visiting NI forums I have updated the ini file as suggested by many posts and I have also connected a string constant to the Open VI Reference function instead of file path.
Please note that I have almost tried all the solutions given in different posts of NI forums but the problem still persists.
All the related VIs, EXE, ini and error snapshot are attached herewith. Please guide on how I can remove this error.

0 Kudos
Message 1 of 13
(6,466 Views)

Hi akhtar,

 

how and where are you trying to "access this “Test123.EXE” from the Open VI Reference function"?

Nevermind, found the "Accessing" VI.

 

Are you sure you want to open Test123.vi when that VI is located in

Is the executable running when you try to access it?

 

(The Executable is just heating up one CPU core as fast as it can.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 13
(6,435 Views)

Hi GerdW,

Thanks for your reply.

Currently I am running both the "Accessing Test123.vi" and Test123.EXE on the same computer and therefore I am using "localhost" in the machine name but ideally the Test123.EXE will be running on a different system on the network. I will access it through "Accessing Test123.vi" by the using the IP address.

This actually is a bigger project and I have just made these simple VIs for you people so that you can understand my problem easily and help me out.

And yes the Test123.EXE is running when I run the "Accessing Test123.vi"

0 Kudos
Message 3 of 13
(6,417 Views)

It has been many years since I abandoned VI Server, but as I recall, it is used to access VIs located on a remote (or the same) PC.  An Executable is not a VI!  Note your code for Accessing Test123 specfies that you want to load Test123.vi, not Test123.exe.  VI Server runs LabVIEW and reaches out to execute the (LabVIEW) code found "somewhere else".

 

I have had multiple routines (as executables) running on different PCs.  I've written them using something like a QMH (Queued Message Handler) Design, with Messages being exchanged via Network Streams.  It worked rather well, though was more complex than communicating with VIs using VI Server.

 

Bob Schor

0 Kudos
Message 4 of 13
(6,412 Views)

Hi,

 

According an article by NI the executable can be accessed using VI server. Here is the link:

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019LbZSAU

 

There are multiple posts on NI forum which suggest that accessing an executable using VI server is possible by simply adding a few lines in the ini file of the executable.

0 Kudos
Message 5 of 13
(6,403 Views)

Thanks!  I didn't know that.  It's a rare week when I don't learn something new in the Forums!

 

Bob Schor

0 Kudos
Message 6 of 13
(6,393 Views)

Running from memory...

 

You have to enable VI server in the project when the exe is built. You also may have to verify you are using the proper port.

 

But if the VI you are targeting is already open and running as top-level, then I think that will be an issue. I have always targeted VIs that were called by the top-level VI.

 

It also used to be "the way' to run VIs on a RT target. Open a ref to VI server on the target, provide the complete path to the VI on the target machine and the run the VI allowed us to sequence through running multiple VIs on a RT target.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 13
(6,381 Views)

Another note that is true but not readily apparent....

 

Getting VI server to work with an exe is a lot like Radagast's staff that he lent to Gandalf with the note "you have to fiddle with it a bit". But it does work.

 

Show the path of the target VI in a front panel indicator to make it easier to figure what the final path is once it is in the exe.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 13
(6,366 Views)

I made this ages ago.  You might find something useful inside it.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 10 of 13
(6,355 Views)