YOUSEFUL / FILEMAKER

YsflUI — function reference

FAQ, examples and tutorial

Function prefix YsflUi_, 27 functions. Windows only. All failures return ? message; details through YsflUi_LastError / YsflUi_LastErrorText.

YsflUi_MenuShow ( definition ; {anchor} ; {options} ) → the chosen item's value, or "" when dismissed.

Definition: one item per line.

line meaning
Label item; returns Label
Label|value item; returns value
Label|value|flags flags: any of disabled, checked, bold (space separated)
- separator
<tab>Label|value nested under the previous top-level item (one level of submenus)

Anchor: empty = current mouse position; x,y = screen pixels; object:<name> = below the named layout object (uses GetLayoutObjectAttribute bounds scaled by the window DPI; best effort). Options: right or center to align the menu to the anchor.

Example
Set Variable [ $pick ; YsflUi_MenuShow ( "Open¶Rename|ren¶-¶Delete|del|disabled" ; "object:btnActions" ) ]

Global hotkeys

Function Returns
YsflUi_HotkeyRegister ( keyCombo ; scriptName ; {options} ) numeric id
YsflUi_HotkeyUnregister ( id ) 0; * removes all
YsflUi_HotkeyList id|combo|script|file|layout lines

Combos use +: modifiers Ctrl, Alt, Shift, Win; keys A–Z, 0–9, F1–F24, Enter, Tab, Esc, Space, Backspace, Delete, Insert, Home, End, PageUp, PageDown, Up, Down, Left, Right, Numpad0–Numpad9, or any single character. Options (space separated key=value): file=<name> (default: the calling file), param=<text>, layout=<name> (fire only while that layout is current), control=halt|exit|resume|pause (what happens to a script already running; default pause). Hotkeys are system-wide; a combination another program owns fails with ? HotkeyRegister: Hot key is already registered. All hotkeys are released when the plugin unloads.

Simulated input and screen

Function Returns
YsflUi_TypeText ( text ) 0; types Unicode text into the focused control (newlines press Enter)
YsflUi_SendKeys ( combos ) 0; space-separated combos, e.g. Ctrl+A Delete Tab
YsflUi_MousePosition x,y
YsflUi_MouseMove ( x ; y ) 0
YsflUi_MouseClick ( {x} ; {y} ; {button} ; {options} ) 0; left (default), right, middle; option double
YsflUi_HitRegion ( x ; y ; regions ) label of the first left,top,right,bottom,label line containing the point, else ""
YsflUi_Cursor ( name ) 0; arrow, wait, hand, cross, ibeam, no, appstarting, help, default (restore)
YsflUi_Screen ( {attribute} ) width, height, workWidth, workHeight, dpi, scale, monitors, virtualWidth, virtualHeight; empty = width,height

YsflUi_Cursor changes the system-wide arrow cursor until default is passed or the plugin unloads.

Clipboard

Function Returns
YsflUi_ClipboardFormats format names, one per line (CF_UNICODETEXT, CF_HDROP, registered names as-is)
YsflUi_ClipboardGetText ( {format} ) text; empty format = Unicode text; named formats are read as UTF-8
YsflUi_ClipboardSetText ( text ; {format} ) 0; replaces the clipboard
YsflUi_ClipboardHas ( format ) 1 / 0
YsflUi_ClipboardGetFile ( format ; path ) 0; raw bytes of that format written to path
YsflUi_ClipboardSetFile ( path ; format ) 0; the file's bytes placed under that format
YsflUi_ClipboardGetFiles paths from a file copy (CF_HDROP), one per line
YsflUi_ClipboardSetFiles ( paths ) 0; puts a file list on the clipboard (paste in Explorer)
YsflUi_ClipboardClear 0
YsflUi_ClipboardGetSnippet ( type ) fmxmlsnippet XML, or ""
YsflUi_ClipboardSetSnippet ( type ; xml ) 0

Snippet types and the registered formats FileMaker uses on Windows:

type format
script Mac-XMSC
step Mac-XMSS
field Mac-XMFD
table Mac-XMTB
layoutobject Mac-XMLO
customfunction Mac-XMCF
valuelist Mac-XMVL
theme Mac-XMTH

The payload is a 4-byte little-endian length followed by UTF-8 XML; YsflUI strips it on read and adds it on write. These names come from community documentation of FileMaker's clipboard; confirm with YsflUi_ClipboardFormats after copying an object in FileMaker if a type does not round-trip.

Plugin

YsflUi_Version, YsflUi_Register ( {option} ), YsflUi_LastError, YsflUi_LastErrorText.