A better alternative to the above is to make the game title only the key and not one of the values, then you don't even need an array with two properties inside each array element. Now you just have an associative array with the game title as the key and the file name as the value. So just change the line that assigns the elements to the array to this:
Code: Select all
ListFullData[Match2] := Trim(Match1)
Enumerating the array is even easier and in alphabetical order by game title:
Code: Select all
ListFullText =
(
filename "World of Warcraft"
filename2 "Minecraft"
filename3 "Red Dead Redemption"
filename4 "League of Legends"
filename5 "Halo Infinite"
)
ListFullData := {}
Loop, Parse, ListFullText, `n, `r
{
RegExMatch(A_LoopField, "([^""]*)""(.*)""", Match)
ListFullData[Match2] := Trim(Match1)
}
; act on each item in alphabetical order of game title:
for GameTitle, FileName in ListFullData
MsgBox, % "File name: " FileName "`n`nGameTitle: " GameTitle
It has the extra (main?) advantage of not having to search for a game title to get its filename since the game title is the key. You would just do this:
Code: Select all
MsgBox, % ListFullData["League of Legends"] ; result: filename4