Sometimes, when writing a FileMaker script to do a find, sort, or export, doing it manually first can save you LOTS of time.
I was just tasked with creating a script to export all the fields on a layout. The layout, however, is non-trivial and contains fields from multiple different tables, and the relationship graph I inherited is very complicated and nearly impossible to decipher. It would have taken me HOURS to identify the table occurrence and field name of every field on this layout and then set up the export in a script.
What I did instead was first perform the export manually. When exporting manually, the Specify Field Order for Export dialog defaults to showing you all the fields on the current layout, including the related fields (when writing a script, the same dialog only allows you to choose each table, since there is no “current layout” for the script to use). I chose the Move All button to select all the fields on the layout, went back to editing the script, added the Export Records script step, and chose Specify export order. The last, just-performed export was already there by default. I was done in minutes.
You can use the same idea to speed up specifying a sort order (where you can again choose the current layout’s fields) or search (where it’s easier to find fields laid out on the screen, rather than hunting around for them in the Edit Find Request dialog).