LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to open a .txt file from a real-time application

Hello:

 

I'm fairly new to labVIEW and have come across a little problem I can't figure out.  We use cRIO's and run real-time applications on them using the minidisplayport to view the front page.  We are use 2015 SP1.  The VI controls a piece of equipment. Primarily data aquisition.  At specified intervals the operator will push a "snapshot button" which saves temperature and pressure values to a datasheet.txt file which is in a folder i created on the cRIO.  I want to add a button on the front page that will open the .txt file so that the operator can view it.  I'm using the System Exec.vi to open the file.  When I tested it on my pc it works fine.  I wired "notepad datasheet" to the command line and when the button is pushed the VI launches notepad and then loads the file (datasheet.txt).  When I try it on the deployed VI on the cRIO I cannot get it to work. I believe the "notepad" on the cRIO is called "mousepad". So I tried wiring "mousepad datasheet" to the system exec VI but no dice.  I've tried the full path of the file in the command line and still no dice.  Any help would be great.

 

Thank you

0 Kudos
Message 1 of 11
(1,970 Views)

I'm quite sure the cRIO does not have notepad.  And I've never heard of "mousepad".  Where did you hear about this?

 

Instead of using a system exec command, why not just have VI that is called and opened dynamically in parallel that reads the test file and displays it in a large string indicator.

0 Kudos
Message 2 of 11
(1,951 Views)

Thank you for your response.  If you connect a keyboard, mouse and monitor to the cRIO you can open and rummage around in the file manager.  If you double click on a read me file, text document or even a INI file, they will open in a window.  The top of the window says "mouse pad" so I assumed that mouse pad is the default linux text reader that the cRIO uses.  So my theory is that if I can call Notepad and open a text file from my VI (using system exev VI) when it is run on a PC.  Then I should be able to do the same in the linux environment when my VI is running on a cRIO.  I think I'm just not writing the command line correctly.

 

Thank you

0 Kudos
Message 3 of 11
(1,904 Views)

You may need to call it via a full path.  Notepad can be found in Windows' PATH list, so you don't need to call it by its full path.

Message 4 of 11
(1,898 Views)

Yes I tried that and it still doesn't seem to work.  The command line input is a string so this is the path I'm using

"/c/files/datasheet.txt" in string form.  I placed a folder named "files" on the c drive of the cRIO. The system exec VI has an input for a path but the instructions say not to use it to find the file.  The command line is used for this.

0 Kudos
Message 5 of 11
(1,885 Views)

Did you try the full path to the mousepad application?

0 Kudos
Message 6 of 11
(1,881 Views)

I tried to find it in the file manager but I can't find it. 

0 Kudos
Message 7 of 11
(1,876 Views)

@RavensFan wrote:

I'm quite sure the cRIO does not have notepad.  And I've never heard of "mousepad".  Where did you hear about this?

 

Instead of using a system exec command, why not just have VI that is called and opened dynamically in parallel that reads the test file and displays it in a large string indicator.


Yeah if you didn't realize it yet mousepad is the text editor installed with XCFE interface (the new cRIOs running RT Linux with a display).

 

You can open mousepad with a text file the same way you can notepad.  Just pass in the path to the file as the first parameter.

 

Otherwise you can do as others have said and write a VI that uses the Read Text File and displays it on the front panel.

 

EDIT:  Actually it seems the logged in user on the UI and the one from a VI are different and I'm having difficulty when doing this from a VI.  But in a terminal in the main UI you can just type mousepad ./<File Name> and it will open it.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.
Checkout and help contribute to the community driven LabVIEW Wiki.

Message 8 of 11
(1,859 Views)

Okay figured it out.  You need to specify what monitor the program needs to be opened on, then invoke the command with the path to the file to be opened.

 

Example_VI_BD.png

 

(BTW I love RT Linux)


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.
Checkout and help contribute to the community driven LabVIEW Wiki.

Message 9 of 11
(1,854 Views)

Oh and I actually just thought about this.  You can install Wine if this is a x86 based controller, so that Windows programs run in Linux.  If you do this notepad is actually included in the virtual environment and the command call wine notepad ./<File Path>.txt will actually work as well but it is quite a bit of overhead and extra files just to view a text file.  You'll still need to specify the display as I showed with mousepad.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.
Checkout and help contribute to the community driven LabVIEW Wiki.

Message 10 of 11
(1,850 Views)