LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview- Excel template path at run time(to build .exe file)

Do you mean how to find your "Data" folder when you're using your .exe file? Or do you mean before you create your .exe and still are just running your main.vi file?

 

Also, what version of LabVIEW do you use? Maybe I can create an example for you.  

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 11 of 20
(1,954 Views)

Thank you so much Even,

Now I have .vi file which is having local drive path to access my excel templates. But I have to convert this .vi file in to .exe file and give to client. The client wont be having the excel template, So this is the problem here.[Finally I have to create one .exe file which should have templates inside]

 

It will be greatful if you send me some example code.

0 Kudos
Message 12 of 20
(1,953 Views)

Forgot to tell my labview version. Mine is 10.0 (Labview 2010)

 

Below is what i did so far,

under C: drive I created one folder "PROJECT_FOLDER" under this folder I have four folders Bin, Data, Doc, Img.

Under Bin folder I have Main.vi file and subvi folder which is having subvi files.

Under Data file i have 3 excel templates

Now I created one new project. In this project I have chosen "PROJECT_FOLDER" as autopopulating folder.

[Now my doubt is how to give path to my main.vi file such that it should work after converting it into .exe file in client's PC ]

0 Kudos
Message 13 of 20
(1,951 Views)

Ahhh! I understandSmiley Happy

 

Well, the case is that you cannot have an Exe file which includes these templates you're talking about. You will have to create an installer, which install the .exe file + the templates on your clients computer. In your .exe file you need to call thses templates. You know, using a path system that will allow you exe to find the templates. 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 14 of 20
(1,946 Views)

I'll create an example for you in a whileSmiley Happy

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 15 of 20
(1,945 Views)

Thanks Even, It will be great if you send me example. meanwhile I too will try..:) (My labview version is 10.0 (Labview 2010))

0 Kudos
Message 16 of 20
(1,940 Views)

Hi!

 

I've created a small example for you. Here is what I did:

 

1. Created a folder on my desktop called "My project"

2. Created the following folders inside:

1.PNG

3. Inside "Bin" I've created a "main.vi"

4. Inside "Data" I've created a textfile called "Template.txt".

5. Inside the textfile I've written "Hello World!".

6. In my "Main.vi" I would like to read that textfile and put it inside an array.

7. to be able to read the file, i have to know the path to that spesific textfile.

8. My "Main.vi":

2.PNG

9. As you can see, I've created a file path constant that tells my program where to find that file. And it always will, unless I change folder name, textfile name, or the location of the file. On your computer this is OK since the textfile is already there. If you create an exe file now, with this file path contant, the program will find the file and read it. But if you send the exe file to a client and he/she runs the program, the program will not find the text file. How can we solve this? We have to create a LabVIEW project!

10. I've created a project and saved it in the "Proj" folder as shown in the first image.

11. I then add my folder called "My Project" as an auto-populating folder. Giving me the following:

3.PNG

12. You can see my "Main.vi" and the textfile called "Template.txt". Now I would like to create an EXE file so that I can run my program.

13. Right-click "Build Specifications" and select "New" and "Application".

14. There are many things you can specify in your EXE file. I've just changed where to save the built EXE file. In this case I save it in the "Build" folder as shown in the first picture.

15. Now comes the keypart. Which VI is the main VI and which should alway be include. In this case it's the Template file:

4.PNG

16. Select what you want to include and use the blue arrows to add them. Here I've added the data folder.

17. Press Build. You will now end up with this in your Build folder:

 5.PNG

17. Inside the "data" folder you'll find the Template textfile.

18. Now we must create and Installer. Go to the project and right-click "Build Specifications". Select "New" and "Installer".

19. You can do alot with the installer, but the key thing is to select where the program will be installed on your clients computer.

20. Select "My Application" and use the blue arrow to add your program and the template to the Programfiles folder. Like this:

6.PNG

21. Then press build. If you run the installer the program and the template will be installed under this path(on my computer): C:\Program Files\My project 

22. OK - Let's summary this up. We have created the program and got the template installed on the clients computer. The only problem: The client can't find the file. How do we fix that? We have to change our "Main.vi" to make the program find the template file.

23. I change my blockdiagram like this:

7.PNG

24. The path to the template will now be where the application EXE file is and a subfolder called data and the Template.txt file.

25. Great success! 

26. With the installer the client can select where to install the program. The Template will alsways be in the data folder together with the EXE file. And the EXE file will find the template file in the data folder. This is just the basic. You can do ALOT more to make the program more bulletproof in which way the program should find the template. 

 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
Message 17 of 20
(1,922 Views)

Woow....Great work Even..:) I will try this & come up with good news to u...thanks a lot..:)

0 Kudos
Message 18 of 20
(1,917 Views)

Hi Even I did all the steps as you said. I am facing a new problem When I try to build inorder to create .EXE file. Its showing somthing like "Shell32.dll" error. I have attached the screenshot of that error meaasage as image file. Plz chk that.  

[my labview version is 10.0 (Labview 2010)]

 

 

Thanks in advance

--

saamy

0 Kudos
Message 19 of 20
(1,893 Views)

Hi again!

 

Hmm.. I've never encountered this problem before. What I can see is that you got a really long filepath where the exe file should be built. try to use shorter filenames, foldernames and try another folderpath. I usually just use a short filepath like:

D:\LabVIEW\Projects\builds\appnamefolder 

 

In most cases the problem is that the application builder does not handle long filenames, folder names and filepaths.

 

Please correct me if wrong. 

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
0 Kudos
Message 20 of 20
(1,879 Views)