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}')
- parts += [f'{L1}', f'{S}']
+ parts.append(f'{L1}')
+
+ # Emit InputFields only when at least one slot is populated. FM's
+ # canonical snippet shows three slots even when only one is used, so
+ # mirror that — empty slots become .
+ if any(f is not None for f in input_fields.values()):
+ parts.append(f'{L1}')
+ for slot in (1, 2, 3):
+ f = input_fields[slot]
+ if f is None:
+ parts += [
+ f'{L2}',
+ f'{L3}',
+ f'{L2}',
+ ]
+ continue
+ parts.append(f'{L2}')
+ if f['kind'] == 'variable':
+ parts.append(f'{L3}{escape_attr(f["var"])}')
+ elif f['kind'] == 'field':
+ parts.append(
+ f'{L3}'
+ )
+ else:
+ parts.append(f'{L3}')
+ if f['label']:
+ parts += [
+ f'{L3}',
+ ]
+ parts.append(f'{L2}')
+ parts.append(f'{L1}')
+
+ parts.append(f'{S}')
return '\n'.join(parts)
diff --git a/filemaker/agentic-fm.xml b/filemaker/agentic-fm.xml
index e52400a3..a1d326ff 100644
--- a/filemaker/agentic-fm.xml
+++ b/filemaker/agentic-fm.xml
@@ -271,20 +271,69 @@
+
+ Ensure ~/Desktop/agentic-fm/ exists for the XML export.
+
+
+
+ do shell script "mkdir -p ~/Desktop/agentic-fm"
+
-
+
$output
+
+ Pre-clean: Save a Copy as XML won't overwrite an existing file.
+
+
+
+
+
+ $output
+
+
+
+
$output
+
+
+
+
+
+
+
+ $saveError
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+