Show Custom Dialog InputFields converter + Explode XML hardening#48
Open
kirkabowman wants to merge 1 commit into
Open
Show Custom Dialog InputFields converter + Explode XML hardening#48kirkabowman wants to merge 1 commit into
kirkabowman wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two unrelated fixes that surfaced during the same refactor pass.
Converter —
fm_xml_to_snippet.pytx_show_custom_dialogpreviously emitted onlyTitle,Message, andButton*— it silently dropped anyField1/Field2/Field3parameters. 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:
<Parameter type="FieldN">block (1-3)<FieldReference>(with optionalTableOccurrenceReference) and<Variable>Passwordboolean →UsePasswordCharacterattributeLabelcalculation<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.xmlInteractive mode previously saved directly to
~/Desktop/<solution>.xmlwith no error checking. If FM'sSave a Copy as XMLfailed (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 intoxml_exports/. The user only saw FM's cryptic "could not be created on this disk" dialog, with no script-level fallback.Changes:
~/Desktop/agentic-fm/<solution>.xmlinstead of cluttering the Desktop.Perform AppleScript [ do shell script "mkdir -p ~/Desktop/agentic-fm" ]before the save.Set Error Capture [ On ]→Delete File [ $output ]→Set Error Capture [ Off ]removes any stale 0-byte file from a prior failed run.Save a Copy as XML, captureGet(LastError)and surface a descriptive dialog (path + error code +LastErrorDetail+ common-cause hints) before exiting. No more silent failure path.Test plan
<Parameter type="Field1">with aFieldReferencetarget. Verify the resulting fmxmlsnippet has an<InputFields>block with three<InputField>entries — populated slot has the righttable/id/name, empty slots match FM's<Field table="" id="0" name=""/>form.<Parameter type="Field1">whose target is a<Variable value="$x"/>. Verify the output uses<Field>$x</Field>(variable form).filemaker/agentic-fm.xml). Delete~/Desktop/agentic-fm/if present.~/Desktop/agentic-fm/is created and the export lands inside.~/Desktop/agentic-fm/<solution>.xml(e.g.touchit as empty). Re-run Explode XML. Verify the pre-clean removes the stale file and the save succeeds.🤖 Generated with Claude Code