This purpose of this subroutine is to extract a specific line from a list of items.
So if you had a list of items e.g.
Item 1
Item 2
Item 3
Item 4
and you ran this subroutine asking for line 2, the subroutine would return the value
Item 2
Since it uses AppleScript at its heart, you can get the last item in the list by specifying -1
; the next to last by specifying -2
; and so on.
By asking for line 0, the subroutine will return the count of the number of lines in the list.
Here is the subroutine:
[SUB] Get Line From List.kmmacros (4.9 KB)
To help you become familiar with its operation, here is a macro to test the subroutine. It's very simple so you should have little trouble working out how it might fit into your own use-cases.
Test [SUB] Get Line From List.kmmacros (5.8 KB)
As usual this has been tested but it comes with no warrantees nor guarantees.