LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem opening pdf file with an application

Hi There,
 
I have a problem with opening my pdf file after build an execution with labview.
When pressing a "help" Button in my Software, a pdf File should be opened. It works fine with my .vi version. I use Labview 7.1 and the browser.llb (open a Document on Disk.vi).
I also use a construction shown in this forum. This construction allows me, to use the .vi path to open my pdf and not a Hardware path.
Well and it works fine as long as i use Labview with all the subvi's.
Now i want to build an exe Application. In this Application my "help" Button  opens Acrobat, but display an Error: path doesn't exist.
 
Can someone tell my please, how to compile correctly. Or tell me, why the path now differs?
 
Thanks for your help...
 
Best regards
 
Steve
0 Kudos
Message 1 of 14
(4,420 Views)
Hi Steve
 
It sounds as if you did not build the path correctly.
Have a look at this thread:
 
Hope this helps.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 2 of 14
(4,406 Views)
Thanks for this quick reply!
 
Well, according to your linked Thread, i could strip the path twice? Right?
I don't understand the discussion about the "OpenG", cause i'm a noob in Labview 🙂 my first project...
So, to strip the path twice would fix my problem?
 
Thanks
 
Steve
0 Kudos
Message 3 of 14
(4,403 Views)

Yes and no.

Let's do a little example:

Assume you have a main vi, which is in a llb (let's say main.llb\Main.vi). This library is in a root-directory (let's say ..\Program Files\MyApp). Your pdf-file is in a subdirectory of root-directory.

Now, if you access the pdf-file from the vi Main in the LV development environment, you can use the function "Current VIs path" to get its path and then strip it once (results in ..\Program Files\MyApp\main.llb) and then a second time (results in ..\Program Files\MyApp) - so you reach the root directory of your app.

If you compile your app to an exe, you can use the properties mentioned in the other thread to get this directory directly. If you would use the "Current VIs path" function you would get ..\Program Files\MyApp\Application.exe\main.llb\Main.vi. So in the LV IDE, you have to strip it - using the properties mentioned, you would get the directory of the LabVIEW.exe.

What I can suggest you is, that you create a vi, that reads several paths with several methods, compile it to an exe and then compare - just to get used to it. This helped me a lot.

OpenG is some kind of open source project for LV. Just visit http://www.openg.org to learn about it.

Hope this makes it easier for you.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 4 of 14
(4,397 Views)
Well, okay, shame on me, my whole Software works, just that little Button makes trouble...
I checked my Software again and i strip my path once. Now my pdf file has to be in the same directory as the vi. I have just one main.vi and 2 subvi's...to my opninion it should work, the way i did it...with current path and the same Directory...
Can you please check the attachement and have a look if you find any mistakes?
 
I use the "Current Vis Path" and the "Open a Document on Disk.vi"
 
Thanks a lot...
 
 

Message Edited by SteveDe on 03-02-2006 06:03 AM

0 Kudos
Message 5 of 14
(4,390 Views)
Well - what you've done works definitely. I'd just suggest you to use the "Build path" function instead of converting a path to a string, append another string and then convert it back - but as I said, it works.
 
Could you post the sub vi you're calling in this case?
 
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 6 of 14
(4,380 Views)
Hi,
 
you have a lot of patience with me...thanks 🙂
In the attachement you can see the subvi "open doc". It's a LV vi.
Perhaps you can explain me the "Build Path" way, or give an example for LV....
 
Thanks a lot!!!
 
Greetings
 
Steve
Download All
0 Kudos
Message 7 of 14
(4,380 Views)

Could you either post it or tell me where I can find this vi?

I've never seen this before.

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 8 of 14
(4,373 Views)
Of course i can:
 
its a vi from LV: in the C:\Program Files\National Instruments\LabVIEW 7.1\vi.lib\Platform\browser.llb and then the first one "Open Acrobat Document"....i just pick the vi and put it into my program, then set the path to string and so on construction into the case with the vi and stick it to my help button...voila, ca marche, but after compiling the Acrobat Reader opens, but not my pdf...its a whining 🙂
 
Greetings

Message Edited by SteveDe on 03-02-2006 06:51 AM

0 Kudos
Message 9 of 14
(4,373 Views)

Somehow I must have been far away with my thoughts...

What you wired works - but just as a normal vi in the LV IDE. If you compile it, it won't work anymore.

So here is the difference:

If you run your vi, the path looks like this: ..\DirectoryX\PowerMosFet.pdf

If you compile the vi and run it as an application, it looks like this: ..\DirectoryX\Application.exe\PowerMosFet.pdf

This is exaclty what I tried to describe - you get different paths. Have a look at this picture and to it the same way:

By the way - it's just one case structure, but I wanted to show you all cases in use.

Message Edited by becktho on 03-02-2006 02:10 PM

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 10 of 14
(4,366 Views)