Take a look at the FIeldNames function--which should work in FMP 8 as well as 13.
I produces a return separated list of all the field names located on a given layout.
that would be perfect if I didn't have to specify a layout as adding new fields to the file would require going back and adding them to the layout to be able to see them in the script. I would like to make the script autonomous and not have to rework the layout if there is a change down the road.
This may be the only way to go about it though.
Using the FileMaker 13 Field picker, you can add all fields for a given table to your layout pretty quickly.
You can click the first field in the picker, then shift click the last field listed before doing a drag and drop to add all fields to the layout.
So the routine to update your layout after adding more fields might be:
Enter layout mode
ctrl-a (select All)
Click to open field picker and use it to add all fields to the layout.
There must be a way to access the Table list of fields too eliminating having to remember to do this in the future.
Not as far as I know, which is why I suggested FieldNames. I suppose there might be a plug in that can do what you want.
Frankly, I've never needed such a list for any of my scripts and I speak as someone who started using FileMaker when it was a flat file with a version number of 2.5.