03-14-2018 03:29 AM - edited 03-14-2018 03:33 AM
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.
Solved! Go to Solution.
03-14-2018 04:17 AM - edited 03-14-2018 04:32 AM
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.)
03-14-2018 08:11 AM
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"
03-14-2018 08:33 AM
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
03-14-2018 09:25 AM
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.
03-14-2018 11:29 AM
Thanks! I didn't know that. It's a rare week when I don't learn something new in the Forums!
Bob Schor
03-14-2018 12:22 PM
Test123.ini needs a server.tcp.acl key. The key needs to be generated during the build.
https://forums.ni.com/t5/LabVIEW/What-is-server-tcp-acl-in-ini-file/td-p/3599674
http://www.notatamelion.com/2015/05/25/using-vi-server-to-interact-with-executables/
03-14-2018 03:00 PM
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
03-15-2018 08:08 AM
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
03-15-2018 11:05 AM
I made this ages ago. You might find something useful inside it.