From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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,338 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,328 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,309 Views)
Solution
Accepted by topic author 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.

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
Message 4 of 5
(3,291 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,279 Views)