Skip to content

Show Custom Dialog InputFields converter + Explode XML hardening#48

Open
kirkabowman wants to merge 1 commit into
petrowsky:mainfrom
kirkabowman:show-custom-dialog-explode-xml
Open

Show Custom Dialog InputFields converter + Explode XML hardening#48
kirkabowman wants to merge 1 commit into
petrowsky:mainfrom
kirkabowman:show-custom-dialog-explode-xml

Conversation

@kirkabowman
Copy link
Copy Markdown

Summary

Two unrelated fixes that surfaced during the same refactor pass.

Converter — fm_xml_to_snippet.py

tx_show_custom_dialog previously emitted only Title, Message, and Button* — it silently dropped any Field1/Field2/Field3 parameters. Round-tripping a Show Custom Dialog that prompts for input lost the input fields, so the developer saw a dialog with the message but no input slots.

Now the handler:

  • Reads each <Parameter type="FieldN"> block (1-3)
  • Handles both target shapes: <FieldReference> (with optional TableOccurrenceReference) and <Variable>
  • Reads the Password boolean → UsePasswordCharacter attribute
  • Reads the optional Label calculation
  • Emits the FM-canonical <InputFields> block with three <InputField> entries (empty slots become <Field table="" id="0" name=""/>)

Verified by extracting a Show Custom Dialog with two input fields (one field-ref + one password field) from a SaXML export and round-tripping it through the converter — output matches FM's clipboard form exactly.

Explode XML script — filemaker/agentic-fm.xml

Interactive mode previously saved directly to ~/Desktop/<solution>.xml with no error checking. If FM's Save a Copy as XML failed (most commonly because a stale file already existed at the target path — FM won't overwrite), the script kept going and POSTed the path to the companion, which then archived a 0-byte file into xml_exports/. The user only saw FM's cryptic "could not be created on this disk" dialog, with no script-level fallback.

Changes:

  • Subfolder: save to ~/Desktop/agentic-fm/<solution>.xml instead of cluttering the Desktop.
  • Auto-create folder: Perform AppleScript [ do shell script "mkdir -p ~/Desktop/agentic-fm" ] before the save.
  • Pre-clean: Set Error Capture [ On ]Delete File [ $output ]Set Error Capture [ Off ] removes any stale 0-byte file from a prior failed run.
  • Error reporting: after Save a Copy as XML, capture Get(LastError) and surface a descriptive dialog (path + error code + LastErrorDetail + common-cause hints) before exiting. No more silent failure path.

Test plan

  • Convert a SaXML script containing <Parameter type="Field1"> with a FieldReference target. Verify the resulting fmxmlsnippet has an <InputFields> block with three <InputField> entries — populated slot has the right table/id/name, empty slots match FM's <Field table="" id="0" name=""/> form.
  • Convert a SaXML script with a <Parameter type="Field1"> whose target is a <Variable value="$x"/>. Verify the output uses <Field>$x</Field> (variable form).
  • Re-install the updated agentic-fm script folder (paste filemaker/agentic-fm.xml). Delete ~/Desktop/agentic-fm/ if present.
  • Run Explode XML from FileMaker. Verify ~/Desktop/agentic-fm/ is created and the export lands inside.
  • Manually leave a stale ~/Desktop/agentic-fm/<solution>.xml (e.g. touch it as empty). Re-run Explode XML. Verify the pre-clean removes the stale file and the save succeeds.
  • To exercise the error path: drop FM's Desktop permission, re-run Explode XML, and verify the new dialog surfaces the FM error code + detail instead of FM's bare "could not be created" alert.

🤖 Generated with Claude Code

Converter (fm_xml_to_snippet.py):
- tx_show_custom_dialog now emits the <InputFields> block when SaXML
  contains Field1/Field2/Field3 parameters. Previously the converter
  silently dropped input fields, leaving the round-tripped snippet
  missing all "Input Field N" entries. Handles both FieldReference
  and Variable targets, Password flag, and optional Label calc.

Bootstrap script (filemaker/agentic-fm.xml — Explode XML):
- Save to ~/Desktop/agentic-fm/ instead of ~/Desktop/ so the export
  doesn't litter the Desktop.
- mkdir -p the destination folder via Perform AppleScript so the save
  succeeds on first run.
- Pre-delete any stale target file (Save a Copy as XML refuses to
  overwrite). Suppressed via Set Error Capture so a missing file is
  a no-op rather than an error.
- After Save a Copy, capture Get(LastError) and show a descriptive
  dialog with the error code + LastErrorDetail + likely-cause hints
  instead of FM's cryptic "could not be created" alert.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant