attributes of an object by a csv

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

attributes of an object by a csv

05 Aug 2019, 05:19

Hi,
I would like to resolve this problem but to be honest i don't really know if there is a solution.
In some languages it works, in some others not.

i use objects very often as structured variables.

So i do like:

Code: Select all

colors:={}
colors.blue:=1
colors.white:=2
colors.black:=3
what i would like to do is to put the attributes in a csv file then load the propreties and the value in my script. Something like that:

<file colors.csv>
blue,1
white,2
black,3

<code on ahk>
colors.[attribute]:=value


Is it somehow possible to do something like that?

Thank you very much
Odlanir
Posts: 659
Joined: 20 Oct 2016, 08:20

Re: attributes of an object by a csv

05 Aug 2019, 05:52

Code: Select all

FileRead, allfile, colors.csv
colors := Object(Strsplit(allfile,["`n",","])*)
MsgBox % colors.white ; or colors["white"]
____________________________________________________________________________
Windows 10 Pro 64 bit - Autohotkey v1.1.30.01 64-bit Unicode
jekko1976
Posts: 97
Joined: 10 Oct 2014, 07:03

Re: attributes of an object by a csv

06 Aug 2019, 06:55

Thank you! i will try this way!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen and 382 guests