I simply need to turn them into a variable and set them equal to 0.
As per Documentation - Intro - Arrays:
An Array is a variable containing a series of data elements. Each element in this variable can be accessed by an index number which relates to the position of the element within the Array - in AutoIt the first element of an Array is always element [0]. Arrays elements are stored in a defined order and can be sorted.
Removes lines containing list names (; List I
etc.) and empty (or less than three character-) lines (as per $g_sRegexFilter
). Stores remaining lines to 2D array-elements. Example:
#include <StringConstants.au3>
#include <FileConstants.au3>
#include <Array.au3>
Global Enum $ITEM_NAME, _
$ITEM_VALUE
Global Const $g_sFilePath = 'C:\list.txt'
Global Const $g_sFileNewline = @CRLF
Global Const $g_sRegexFilter = '(?m)^(.{0,2}\v)|(;.*\v)$'
Global Const $g_sItemHeader = 'name|value'
Global $g_sFileText = ''
Global $g_aFileItems
$g_sFileText = _TextFromFile($g_sFilePath)
$g_sFileText = StringRegExpReplace($g_sFileText, $g_sRegexFilter, '')
$g_aFileItems = StringSplit($g_sFileText, $g_sFileNewline, $STR_ENTIRESPLIT + $STR_NOCOUNT)
_ArrayColInsert($g_aFileItems, $ITEM_VALUE)
For $i1 = 0 To UBound($g_aFileItems) - 1
$g_aFileItems[$i1][$ITEM_VALUE] = 0
Next
_ArrayDisplay($g_aFileItems, '$g_aFileItems', '', 0, Default, $g_sItemHeader)
Func _TextFromFile(Const $sFile)
Local $hFile = FileOpen($sFile, $FO_READ + $FO_UTF8_NOBOM)
Local Const $sData = FileRead($hFile)
FileClose($hFile)
Return $sData
EndFunc
Returns:
1-Methoxy-2-Propanol | 0
1,2-BUTADIENE | 0
2-Diethyl aminoethanol | 0
2-ETHYL HEXANOL | 0
2-ETHYL HEXYL ACRYLATE | 0
2-Ethyl hexyl lights | 0
2-Ethyl phenol | 0
2-Ethylsuccionitrile | 0
2-Methyl piperidine | 0
2-Methyl-2-Butene nitrile | 0
2-Methyl-2-Pentenal | 0
2-Methyl-3-Butene nitrile | 0
2-Methylglutaronitrile | 0
...
As:
$g_aFileItems[ x ][$ITEM_NAME]
$g_aFileItems[ x ][$ITEM_VALUE]
Add additional columns using _ArrayColInsert()
.
... as there are 1500 of them.
Consider using SQLite. Related.