04-04-2017 07:43 AM
Hello,
I face a strange behavior with System Exec. I searched the forum for similar problem, but no luck so far. Scenario: I use the attached snippet in my code, and it works most of the times. I simply open a pdf file which is in the very same folder as the calling VI (I run from the IDE, no exe!). It just works. However, sometimes it simply stops working, and I have just no idea why. Usually a PC restart helps. Opening the Task Manager does not show the pdf reader (Adobe Acrobat Reader DC) stuck/hanging in memory...
The second part of the snippet shows the mod I made so I can see the output in the cmd line window. It simply says:
"manual.pdf is not recognized as an internal or external command,operable program or batch file."
What is possible wrong here? Why it works for many times, then just stops functioning?
Solved! Go to Solution.
04-04-2017 07:50 AM
Sounds like your Windows fail to call the attached application to the file extension (pdf => Adobe Acrobat Reader).
I can imagine that this happens due to timeouts when trying to "launch the file" if the system is too busy. Once that happens, it is possible that the state is cached somewhere.
Workaround:
Call the application itself and pass the file to open as parameter. That should work more reliably.
04-04-2017 08:10 AM
you could use LabVIEW library which resides in C:\Program Files (x86)\National Instruments\LabVIEW 2015\vi.lib\Platform\browser.llb
use Open Acrobat Document.vi to open PDF.
04-04-2017 08:59 AM
Perhaps it's a path issue.
Similar to Manjunatha.sn2011, I use Open Doc (same llb as Open Acrobat Document) and pass the full path to the document.
(Open Acrobat Document is sort of silly, it is just a wrapper around Open Doc. Either one can open any document
that your system understands.)
These vis are essentially the same code you are using.
04-04-2017 09:52 AM
Thanks guys, yes it looks like a path issue. I modified my code like this, and it started to work and open pdf files again: