How about something along the lines of 'Export Field Contents' to generate the actual file. Populate the field (global field maybe?) with a script that calcs the file. You will probably want a custom function that pads fields with spaces too.
right("lots of spaces here" & string; length)
Thats a bit of a dirty hack as you have effectively hard coded the maximum length, you could recursively add the spaces?
Does 'extract' mean writing (export) a file, or reading/parsing (import) a file?
extracting to a flat file to import to another system that requires position delimited files.
Then you probably need to Export (from FileMaker) to a TEXT file with row(s) of fixed-width (position-delimited) fields. These fields would need to be truncated (if too long) and "padded" if not long enough. Do you have some numbers that need 'precision by decimal' and padded-right with "0"? Do you need to have any dates formatted "just so" (mm/dd/yyyy, yyyy-mm-dd, ???) Do you need a particular delimiter between the fields? Do you need a particular delimiter after each row? Do you need a special character (or two) as "end-of-file"?
Do you currently have a guide/map of the fields needed and the length of these fields? if so, this would be your guide to the correct format of any kind of data.
FileMaker can be used to calculate the necessary text and then use Export script step to push the text to a file. You can name the file with any kind of extension. Remember that this is just a text file formatted as needed from your field data.
ExportFieldContents may also be used, with caveats. See these articles for some ideas on your question:
Thanks to Brian Dunning's CF list, I found one for numbers that I converted to work with the strings, only issue is, I have to manually add the fields to the calculation and call the function on each field but it will have to work.
I figured it out using a CF from Brian Dunning's CF list.