LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec opening pdf does not always work

Solved!
Go to solution

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?

 

cmd_.png

0 Kudos
Message 1 of 5
(3,828 Views)

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.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 5
(3,818 Views)

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.

Message 3 of 5
(3,799 Views)
Solution
Accepted by Blokk

 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.

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
Message 4 of 5
(3,781 Views)

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:

 

cmd1111.png

0 Kudos
Message 5 of 5
(3,769 Views)