From 3d71d5250b24f76cd10135febd4bd9886656d561 Mon Sep 17 00:00:00 2001 From: Kirk Bowman Date: Mon, 18 May 2026 15:53:28 -0500 Subject: [PATCH] Show Custom Dialog InputFields + Explode XML hardening MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Converter (fm_xml_to_snippet.py): - tx_show_custom_dialog now emits the 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 --- agent/scripts/fm_xml_to_snippet.py | 74 +++++++++++++++++++++++++++++- filemaker/agentic-fm.xml | 51 +++++++++++++++++++- 2 files changed, 123 insertions(+), 2 deletions(-) diff --git a/agent/scripts/fm_xml_to_snippet.py b/agent/scripts/fm_xml_to_snippet.py index b91d8327..bfc44e4a 100644 --- a/agent/scripts/fm_xml_to_snippet.py +++ b/agent/scripts/fm_xml_to_snippet.py @@ -339,6 +339,9 @@ def tx_show_custom_dialog(step) -> str: title_calc = '' message_calc = '' buttons = [] # list of (label_str, commit_state_str) + # input_fields[i] = {'use_password': str, 'kind': 'field'|'variable'|'empty', + # 'table': str, 'id': str, 'name': str, 'var': str, 'label': str} + input_fields = {1: None, 2: None, 3: None} for p in all_params(step): ptype = p.get('type', '') @@ -353,6 +356,40 @@ def tx_show_custom_dialog(step) -> str: if b is not None: commit = b.get('value', 'False') buttons.append((label, commit)) + elif ptype in ('Field1', 'Field2', 'Field3'): + slot = int(ptype[-1]) + entry = { + 'use_password': 'False', + 'kind': 'empty', + 'table': '', + 'id': '0', + 'name': '', + 'var': '', + 'label': '', + } + # Password flag + for b in p.findall('Boolean'): + if b.get('type', '') == 'Password': + entry['use_password'] = b.get('value', 'False') + # Target (field or variable) + for sub in p.findall('Parameter'): + if sub.get('type', '') == 'Target': + var_el = sub.find('Variable') + if var_el is not None: + entry['kind'] = 'variable' + entry['var'] = var_el.get('value', '') + continue + fr = sub.find('FieldReference') + if fr is not None: + entry['kind'] = 'field' + entry['id'] = fr.get('id', '0') + entry['name'] = fr.get('name', '') + tor = fr.find('TableOccurrenceReference') + if tor is not None: + entry['table'] = tor.get('name', '') + elif sub.get('type', '') == 'Label': + entry['label'] = get_calc_text(sub) + input_fields[slot] = entry parts = [ f'{S}', @@ -375,7 +412,42 @@ def tx_show_custom_dialog(step) -> str: ] else: parts.append(f'{L2} +