YOUSEFUL / FILEMAKER

Youseful UI: FAQ, examples and tutorial

Learning center · Function reference

Use YsflUI.fmx64 for popup menus, clipboard access, hotkeys and Windows input helpers. Menu and input examples require an interactive desktop.

FAQ

Can a menu return a value different from its label? Yes. Define a line as Label|value. This lets the visible wording change without changing your branches. A dismissed menu returns empty text.

How are separators and disabled entries defined? A line containing - is a separator. The third pipe-delimited part can contain flags such as disabled, checked and bold.

Is a hotkey limited to FileMaker? Registered hotkeys are system-wide and can conflict with shortcuts owned by another program. Keep its returned id and unregister it when finished.

Does setting clipboard text preserve its other formats? No. ClipboardSetText replaces the clipboard. Clipboard operations and simulated input act on the user's desktop, so run them as explicit script actions.

Examples

Classify a point against a rectangular region without moving the mouse:

filemaker
YsflUi_HitRegion ( 10 ; 20 ; "0,0,100,100,inside" )

Result: inside.

Show a two-action menu at the current mouse position:

filemaker
YsflUi_MenuShow ( "Preview|preview¶Export|export" )

Result: preview, export, or empty text if dismissed.

Tutorial

Standalone sample scripts: Action menu.

Goal: build a menu that branches on stable action values, without performing any export or modifying data yet.

  1. Create a script named Youseful - Action menu.
  2. Add these steps:
filemaker
Set Variable [ $choice ; Value: YsflUi_MenuShow (
    "Preview|preview¶Export|export¶-¶Delete|delete|disabled"
) ]
Set Variable [ $error ; Value: YsflUi_LastError ]
If [ $error <> 0 ]
    Show Custom Dialog [ "Menu failed" ; YsflUi_LastErrorText ]
    Exit Script [ Text Result: $choice ]
End If
If [ IsEmpty ( $choice ) ]
    Exit Script [ Text Result: "Dismissed" ]
Else If [ $choice = "preview" ]
    Show Custom Dialog [ "Action" ; "Preview selected" ]
Else If [ $choice = "export" ]
    Show Custom Dialog [ "Action" ; "Export selected" ]
End If
  1. Run it and choose Preview. Expected: Preview selected.
  2. Run again and press Escape. Nothing else should happen. Delete is disabled.
  3. Once the branches work, replace the sample dialogs with your own scripts.

Troubleshooting

Keep labels and values free of embedded pipes and paragraph separators unless you intend to add menu structure. For a menu below a named layout object, pass "object:btnActions" as the second parameter after naming that object in the layout. Positioning depends on the object's bounds and display scaling.