When you use WinAutomation, you eventually come across lists. A text file can be stored as list, the files that you retrieve from a folder are stored in a list, the cells of an excel row are stored in a list. Sometimes, you will need to use a specific item of a list that is saved in a variable (e.g. the first item, the last item, the 9th item etc). In order to retrieve a specific item of a list, you will have to use the following notation:
%VariableName[ItemNumber]%. Keep in mind that the “ItemNumber” should be 0 for the first item of the list, 1 for the second and so on. For example, if you have a list that is stored in the variable %MyList% and contains 10 items, you can retrieve the first item with: %MyList[0]% and the last item with %MyList[9]%.
If you do not know the exact number of items that are stored in the list, you can retrieve the last item with the notation: %VariableName[VariableName.Count-1]%. So, in the previous example, you can retrieve the last item of the list like this: %MyList[MyList.Count-1]%.

