Here is the code.
Code: Select all
Code: Select all
ExtractAction(Action, Contents) {
RegExMatch(Contents, "%Action%((.*))", ActionResult)
RegExMatch(ActionResult, "\((.*?)\)", parenthesis)
StringReplace, parenthesis, parenthesis, (, ``, All
StringReplace, parenthesis, parenthesis, ), ``, All
StringSplit, ArgumentsArray, parenthesis, `,`
Loop, %ArgumentsArray0%
{
ArgumentsArray%a_index% := RemoveInvalidCharacters(ArgumentsArray%a_index%)
}
MsgBox, %ArgumentsArray0% ; ArgumentsArray0 size is 2, ArgumentsArray1 and ArgumentsArray2 contain what I want
return %ArgumentsArray0%
}
Loop %0% {
GivenPath := %A_Index%
Loop %GivenPath%, 1
FilterFile = %A_LoopFileFullPath%
FileRead, Contents, %FilterFile%
result := ExtractAction("ActionName", Contents) ; result will be ArgumentsArray0
MsgBox, %result1% ; result0 size is 2, result1 and result2 are empty
}