YOUSEFUL / FILEMAKER

Getting started with Youseful plug-ins

Learning center · FAQ

This first exercise uses Youseful Text. You need Windows x64, FileMaker Pro, YsflText.fmx64, and a practice database you can edit. No other plug-in or external account is required.

1. Install the plug-in

In FileMaker, open Edit > Settings > Plug-Ins and click Reveal Plug-in Folder. Older releases label Settings as Preferences. Close FileMaker, copy YsflText.fmx64 into that folder, restart FileMaker, and enable YsflText in the Plug-Ins tab. These controls are described in Claris plug-in settings.

For the current user and FileMaker version, the usual Windows destination is %LOCALAPPDATA%\FileMaker\FileMaker Pro\<version>\Extensions\. Claris installation guidance describes the version-specific folder. Use the folder revealed by your own FileMaker installation.

When upgrading, remove the previous version of that product from all loaded Extensions locations before installing its replacement. See Upgrade notes.

2. Confirm that FileMaker can call it

Create a script named Youseful - First calculation with these two steps:

filemaker
Set Variable [ $version ; Value: YsflTx_Version ]
Show Custom Dialog [ "Youseful Text" ; $version ]

Run it. This build returns YsflText v.1.0.0.

Set Variable takes a variable name and a calculation for its Value, as explained in Claris Set Variable. Create each script step in the editor, then put the shown expression in its calculation dialog. Pasting a whole script block into a calculation will not work.

For read-only calculations you can also use Tools > Data Viewer > Watch when advanced tools and your access privileges permit it. See Claris Data Viewer. Use scripts for operations that write files, send mail, change settings or display dialogs; watch expressions can evaluate more than once.

3. Run a useful calculation

Replace the two steps with:

filemaker
Set Variable [ $clean ; Value: YsflTx_Collapse ( "  Youseful   Software  " ) ]
Show Custom Dialog [ "Cleaned text" ; $clean ]

Expected result: Youseful Software.

4. Capture errors before another call

This deliberately invalid pattern demonstrates error handling:

filemaker
Set Variable [ $result ; Value: YsflTx_RegexMatch ( "abc" ; "[" ) ]
Set Variable [ $errorCode ; Value: YsflTx_LastError ]
Set Variable [ $errorText ; Value: YsflTx_LastErrorText ]
If [ $errorCode <> 0 ]
    Show Custom Dialog [ "Pattern error" ; $errorText ]
End If

Expected: a regex error, code 1003. The wording may include the pattern location. Most operational functions clear the plug-in's previous error when they start. Save the result and error information immediately; HTTP status and other getters can also clear the error. File and Query have additional conventions described in their guides.

Reading the examples

Continue with the Text tutorial, or choose another tutorial.