YOUSEFUL / FILEMAKER
Youseful Sched: FAQ, examples and tutorial
Learning center · Function reference
Use YsflSched.fmx64 to queue FileMaker scripts for safe idle time, a future
time, a repeating interval or a condition. The tutorial requires two scripts in
the same open FileMaker file.
FAQ
Why did a five-second job run later? A due job waits until FileMaker supplies a safe idle callback. A running or paused script can delay it. Timing means “no earlier than,” not a real-time guarantee.
Can I wait in a loop for my scheduled script? Do not keep the scheduling script running or paused while waiting for the callback. End it and return FileMaker to normal use so the queued script can run.
Do jobs survive closing FileMaker? No. They are in memory. Recreate recurring jobs when starting the application if your workflow needs them.
How do I cancel one job? Save the id returned when scheduling it, then call
Cancel with that id. "*" cancels all jobs, so use an individual id for examples.
Examples
Read the local timestamp in a predictable text format:
YsflSc_Now ( "iso" )Result: a current timestamp in YYYY-MM-DD HH:MM:SS form.
Queue the script created below:
YsflSc_ScheduleIn ( "Youseful - Reminder" ; 5 ; "param=Hello from Youseful" )Result: a job id. The script runs after this call has returned and safe idle time is available; the id is not the script's result.
Tutorial
Standalone sample scripts: Reminder · Schedule reminder · Cancel reminder.
Goal: display a reminder after the scheduling script finishes.
- Create a script named exactly
Youseful - Reminder:
Show Custom Dialog [ "Reminder" ; Get ( ScriptParameter ) ]- Create
Youseful - Schedule reminder:
Set Variable [ $cleanup ; Value: YsflSc_Cancel ( "youseful-demo" ) ]
Set Variable [ $job ; Value: YsflSc_ScheduleIn (
"Youseful - Reminder" ; 5 ;
"id=youseful-demo param=Hello from Youseful"
) ]
Set Variable [ $error ; Value: YsflSc_LastError ]
If [ $error <> 0 ]
Show Custom Dialog [ "Scheduling failed" ; YsflSc_LastErrorText ]
End If
Exit Script [ Text Result: $job ]The first call removes only this demonstration's prior job. On the first run, an “unknown job” result is expected and is deliberately replaced by the new scheduling call.
- Run Schedule reminder and let it finish. Keep the file open and leave the
debugger unpaused. After at least five seconds, expect
Hello from Youseful. - In a separate script, inspect
YsflSc_Listor cancel the demonstration:
Set Variable [ $cancelled ; Value: YsflSc_Cancel ( "youseful-demo" ) ]Troubleshooting
Check the target script's exact name and its file. Use Info with lastError for
callback failures. If a named id already exists, cancel that job before reusing
the id. Keep param= last on its line when the parameter contains spaces.