# Youseful Software - FileMaker sample script
# Script name: Youseful - Clean names
# Plug-in: YsflText.fmx64 (Windows x64)
# Setup: No fields needed. The input list is embedded in $raw; change that value to try your own list.
# Expected: A dialog displays Alice on the first line and bob on the second line.
# Format: UTF-8 Script Workspace step listing. Add the steps manually; this is not an importable FileMaker file.
# Lines beginning with # are notes; optionally add them as Comment steps.
# Preserve calculation quotes, backslashes, and paragraph symbols exactly.

Set Variable [ $raw ; Value: "  bob  ¶Alice¶BOB¶" ]
Set Variable [ $trimmed ; Value: YsflTx_LinesTrim ( $raw ; "empty" ) ]
Set Variable [ $error ; Value: YsflTx_LastError ]
If [ $error <> 0 ]
    Exit Script [ Text Result: $trimmed ]
End If
Set Variable [ $unique ; Value: YsflTx_LinesUnique ( $trimmed ; "i" ) ]
Set Variable [ $error ; Value: YsflTx_LastError ]
If [ $error <> 0 ]
    Exit Script [ Text Result: $unique ]
End If
Set Variable [ $sorted ; Value: YsflTx_LinesSort ( $unique ; "i" ) ]
Set Variable [ $error ; Value: YsflTx_LastError ]
If [ $error <> 0 ]
    Exit Script [ Text Result: $sorted ]
End If
Show Custom Dialog [ "Clean names" ; $sorted ]
