10-18-2009 06:15 PM
I'm trying to use the example in "Launch a File Programmatically in its Default Application"
http://decibel.ni.com/content/docs/DOC-6125
This code works, but I find that Windows sometimes decides that it cannot find the file that I want to launch. Very frustrating... I'm trying to figure out why, and it's certainly not because I'm providing the incorrect file path. I'l have it working, and then suddenly, it will stop working, giving a popup indicating that Windows can't find the file. I've tried lots of different things to get my arms around what's happening, thinking that it has something to do with security, but I can't crack this nut. Any thoughts?
Thanks, Alan
10-18-2009 11:03 PM
10-18-2009 11:51 PM
Hi smercurio,
The error window pops up immediately, with the text "Windows cannot find 'myfile.pdf'. Make sure you tyed the name correctly, and then try again."
The file is not on a network drive - it's local. I wonder if part of the issue is that I want to do this from within an executable.
10-19-2009 02:10 AM
10-19-2009 08:59 AM
10-20-2009 12:06 AM
Hello smercurio, GerdW,
I'm able to demonstrate my problem without anything other than the attached VI. No executable required... (phew!) BTW, I'm using LV 2009 within Windows Vista. I can try this using XP tomorrow...
Here's what I do to exhibit the problem:
1) Start up LabVIEW, and open the attached VI.
2) Run the VI, which for me should open the file "C:\Users\SRSC\Documents\launch issue.txt"
3) Instead of the file launching, I get the attached popup error, and the "standard error" output from System Exec returns "The system cannot find the file launch issue.txt." This is repeatable if I run the VI again... The command being issued, according to the VI's indicator is cmd /x /c start "C:\Users\SRSC\Documents" "launch issue.txt"
Now it gets strange.
4) Click the Browse button next to the path control to get the Open File dialog
5) Select another file
6) Click the Browse button again, and select "launch issue.txt", which is essentially going back to the default path. You can also "Reinitialize Values To Default"
7) Run the VI... I find that the file "launch issue.txt" now successfully launches! The command issued is the same as in step 3... cmd /x /c start "C:\Users\SRSC\Documents" "launch issue.txt"
I have to conclude that step 3 really isn't issuing the command string to System Exec...
If I close LabVIEW without saving the VI, the above steps are completely reproducible.
Cheers, Alan
10-20-2009 02:21 AM
Hi Alan,
The example doesn't work for me as well (LV 8.5, but this shouldn't matter).
If I change it to the format
cmd /x /c start "" "C:\Users\SRSC\Documents\launch issue.txt"
it works just fine.
Try the attached VI.
Hope this helps,
Daniel