LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port number savings in .ini file (executable with application builder)

is it possible for you to put the images at least with labels?? 

0 Kudos
Message 11 of 37
(1,616 Views)

Config-file-VIs.png

 

This is the way I find these VIs on my machine...

Greets, Dave
Message 12 of 37
(1,611 Views)

It's a VI Snippet, you can drag it and drop to the Block Diagram to get the code, then unhide labels.

Moreover, right clicking on any node, you can discover what's its parent palette.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 13 of 37
(1,593 Views)

Hi Guys

I pretty much got what you guys are suggesting but what should be the path of that .ini file?

And I don't want to select the path when I create Executable. What constant path should I use so that it will automatically read .ini file keys and configure itself when I include this .ini file while building Executable(usually it will appear with .exe file) but while coding how to make it use this included file? 

Hope You got my point.

Thanks And Regards

Baig

 

0 Kudos
Message 14 of 37
(1,577 Views)

a) add a custom destination and copy your ini file therein; an example of custom destinations:Destinations.png

b) choose a directory, as in my previous example; when your program starts, if the ini file does not exist, create it using the Config Files VIs  (create also the directory tree if needed)

 

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 15 of 37
(1,564 Views)

Hi,

 

since several years we have the function GetSystemDirectory in the file constants palette.

Using this function you could get the folder path of

  • User application data (%localappdata%)
  • Public application data
  • several other…

AFAIK Microsoft is recommending the 1st and 2nd folder in this list as data storage for your application. Each user has write access to these folders…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 16 of 37
(1,586 Views)

@pincpanter exactly, thank you for the example.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 17 of 37
(1,575 Views)

Hi Pincpanter and GredW, 

Thank you so much for this information. 

I am extremely sorry for so many questions but i am new to this and

a) I got your idea of  adding custom destination for needed *.ini file but I will have to install this      application(when done) in other systems so will that *.ini file automatically go to this custom destination when we install from Installer.exe??

 

b) Again with this also does not it look for the *.ini file (OR need to specify the specific location again with path build and required *.ini file might not  be there in this location in different systems(PC).

 

Thanks and Regards 

Baig

 

0 Kudos
Message 18 of 37
(1,565 Views)

Hello Baig,

you are right, a) requires an installation of your *.exe on a new machine. With b) you are more flexible, since you hard-code the location into your program.

You can very easily check for presence of the *.ini - file, look at the snippet:

Serial port number savings.png

 

Btw. why doesn't work the snippet of pincpanther on my system (LV2019 32bit) ?? Am I the only one?

Greets, Dave
0 Kudos
Message 19 of 37
(1,550 Views)

@mabaig wrote:

a) I got your idea of  adding custom destination for needed *.ini file but I will have to install this      application(when done) in other systems so will that *.ini file automatically go to this custom destination when we install from Installer.exe??

 

b) Again with this also does not it look for the *.ini file (OR need to specify the specific location again with path build and required *.ini file might not  be there in this location in different systems(PC).


a) That depends on your program. 🙂 I usually do a check if the file exists and if not create a default setting file. Another option is to have an ini-file in your project and have it copied there through the Installer.

You can set the Open config file to "create if not found". You'd still have to handle the empty/default case though, but that should be easy enough.

 

b) see a)

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 20 of 37
(1,548 Views)