I would like to emulate the "Remove Structure from Flow" in a Script - I have found "FCodes.KBD_REMOVE_STRUCT" but I think that is only used to examine a keystroke in a script.
You need KBD_STRIP_FLOWSTRUCTURE, as in:
var fcodes = [FCodes.KBD_STRIP_FLOWSTRUCTURE];
It will make you manually confirm the operation, though, just like the GUI. I'm not sure if there is a way around that.
Open FrameMaker in non-structured format.
Use Constants.FS_FileIsStructured /Constants.FV_StripStructureAndOpen pair in the Open parameters.
This will strip the Structure before opening the file.
I thought that might work too, but I didn't know if using the unstructured interface was an option for you. I'm glad you got it worked out.