LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to open a text file using button click event

hi, How can i open a text file in a textpad or notepad on the click event of a button.?

 

 

Thanks

Jay

0 Kudos
Message 1 of 6
(4,104 Views)

Use System Exec.vi and the following command line:

notepad.exe "<path to the file>"

You have to use the double quotation marks if the path contains any blanks.

 

For starting the default application for a file, like when double clicking in Windows Explorer, you have to use the shellexecute WinAPI function.

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 6
(4,103 Views)

waldemar.hersacher wrote:

For starting the default application for a file, like when double clicking in Windows Explorer, you have to use the shellexecute WinAPI function.


I think you only have to write the path of the file at System Exec.vi (it is easier)

0 Kudos
Message 3 of 6
(4,078 Views)

Pnt,

 

this will not work LV 8.0.1 and LV 8.6 will give back error 193.

 

Attached is a VI to use the ShellExecute WinAPI. The VI is LV 7.1.1.

Message Edited by waldemar.hersacher on 10-09-2008 10:48 PM
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 4 of 6
(4,048 Views)

You are right.

I looked in my vis and here is how is done... (see picture). Needs something more.

 

What does "Verzeichnis" mean ?

 

Thanks for the vi

Message 5 of 6
(4,022 Views)

Pnt,

I just packed it an forgot it is in German. "Verzeichnis" is the directory/folder where the file is located. I think I have to change that to English this evening.

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 6 of 6
(4,004 Views)