LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use writekey.vi to write Keys ONLY

Hi:
 
How do use a use writekey.vi so that I can write an array of keys in a section without having to populate the values?  please review my VI as well as the config file I am trying to write to.  IF this is not possible without changing the actual VI itself, is there a work around? 
 
JoeyCao
 
 
Download All
0 Kudos
Message 1 of 16
(1,528 Views)
Hi,

Do you mean you would like your VI to write just this :

Velocity,10=
Start,5=
LineLight,On=
Scan Start,5=
Scan Finish,5=
LineLight,Off=
Velocity,7=
Start,7=
test,7=

and not this :

Velocity,10=FALSE
Start,5=FALSE
LineLight,On=FALSE
Scan Start,5=FALSE
Scan Finish,5=FALSE
LineLight,Off=FALSE
Velocity,7=FALSE
Start,7=FALSE
test,7=FALSE

if you link an empty string to the "write key.vi"

you will have this :
Velocity,10=""
Start,5=""
LineLight,On=""
Scan Start,5=""
Scan Finish,5=""
LineLight,Off=""
Velocity,7=""
Start,7=""
test,7=""

Would it be ok ?

Otherwise, I assume your keys will be of different type (boolean, numeric, string, etc...) so maybe if you it would be better to write the default value of each type (0 for numeric keys, false for boolean keys, etc...) there would be few changes to make to your VI...


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 16
(1,509 Views)
Here is what I was meaning at the end of my previous post 😉

I hope this will help you...


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 3 of 16
(1,507 Views)

I have a proble using WriteKey vi to update my configuration file.

I write a string my config file as follow but I don need  those symbols :""

How can I write w/o "" symbols?

 

[Model]-----------header

m0="MK12345"

I  need as follow:

m0=MK12345

 

I did write in VBasic and have no problem.

 

 

 

0 Kudos
Message 4 of 16
(725 Views)

I don't think the quotation marks will cause you any trouble.  They are used to show that everything between belongs together.  For instance, if you had text that contained a linefeed, you'd need quotation marks to show that the line below is part of the string and not an error in the ini file.

 

I believe that to be true.

 

EDIT: If you are using your own brute-force reading of the ini file, then i suppose it will affect things.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 16
(719 Views)

Yes it affect my code.

I am using config as follow:

Below[Model] header I will write mn models w/o ""

Later I am using all there are below this header to fill out a combo box.

So every time I select a model I goes to a model header below and got var values  as ss,sp,tt, IOport.

Make sense?

 

 

***********************

--------------How to use ini file
;Header [Models] Add all models in consecutive way ...from m0 to mn
;Model Header...[NA12-0101] add ifo as follow:
;sp=Declare program to use..NK81-000x.
;ss=Declare Speed Sensor wheel NK82-000x
;tt=Declare Thermistor type ...NTC or PTC
;IOport= Declare P0.3 bit output


[Model]
m0=NA12-0101
m1=NA12-0201
m2=NA12-0301
m3=NA12-0401

mn="NA12-0401"

 

[NA12-0101]
sp=NK81-0001
ss=NK82-0002
tt=PTC
IOport=0

[NA12-0201]
sp=NK81-0001
ss=NK82-0003
tt=PTC
IOport=0

[NA12-0301]
sp=NK81-0001
ss=NK82-0004
tt=NTC
IOport=1

[NA12-0401]
sp=NK81-0001
ss=NK82-0005
tt=PTC
IOport=1

0 Kudos
Message 6 of 16
(707 Views)

Under the topic of enough rope to hang oneself...

 

 

Spoiler

Edit "NI_LVCOnfig.lvlib:Write Key (string).vi and right click "remove and rewire" the sub VI named "NI_LVConfig.lvlib:Add Quotes.vi"

 

But you do NOT want to do that!

 

 

 

If the built-in functions are not to your liking you can create a dll from Vbasic code and use that in your application.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 16
(702 Views)

Yes I can do that at home, I am in the work and have not VBasic installed.

Thank you.

 

 

0 Kudos
Message 8 of 16
(698 Views)

Thank you for your help, problem already solved, not anymore quotes when I use writekey.vi.

 

0 Kudos
Message 9 of 16
(683 Views)

@Ubujuq wrote:

Yes it affect my code.

I am using config as follow:

Below[Model] header I will write mn models w/o ""

Later I am using all there are below this header to fill out a combo box.

So every time I select a model I goes to a model header below and got var values  as ss,sp,tt, IOport.

Make sense?

 

 

***********************

--------------How to use ini file
;Header [Models] Add all models in consecutive way ...from m0 to mn
;Model Header...[NA12-0101] add ifo as follow:
;sp=Declare program to use..NK81-000x.
;ss=Declare Speed Sensor wheel NK82-000x
;tt=Declare Thermistor type ...NTC or PTC
;IOport= Declare P0.3 bit output


[Model]
m0=NA12-0101
m1=NA12-0201
m2=NA12-0301
m3=NA12-0401

mn="NA12-0401"

 

[NA12-0101]
sp=NK81-0001
ss=NK82-0002
tt=PTC
IOport=0

[NA12-0201]
sp=NK81-0001
ss=NK82-0003
tt=PTC
IOport=0

[NA12-0301]
sp=NK81-0001
ss=NK82-0004
tt=NTC
IOport=1

[NA12-0401]
sp=NK81-0001
ss=NK82-0005
tt=PTC
IOport=1


Although the ini file "standard" isn't well defined, quotation marks are acceptable in some implementations.  I would hazard a guess that there are more complaints about how to make get values with quotation marks intact than the other way around.  In other words, most built-in ini readers understand that quotation marks are used in the manner i described above, so your request is... unusual.

 

The fact that the "standard" is so ambiguous is probably one big reason a lot of applications use xml files instead.

The more you use LabVIEW, the more you will see that it almost always hews to some standard or other - sometimes frustratingly so.  In other words, if quotation marks weren't acceptable, they wouldn't use them.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 10 of 16
(674 Views)