Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Phidget.SetScriptTrigger
Installs a script trigger with the phidget.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Phidget | 13.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No |
Parameters
Parameter | Description | Example |
---|---|---|
PhidgetRef | The reference number for the phidget. | $phidget |
Event | The name of the event. | "Attach" |
FileName | The file name of the FileMaker database containing the script. | Get(FileName) |
ScriptName | The script name of the script to trigger. | |
Tag | Optional tag value. Goes into the JSON passed to the script, so you can pass whatever you like to the script. |
Result
Returns OK or error.
Description
Installs a script trigger with the phidget.Please check phidgets documentation about what events are available for which device.
The JSON passed to the script will contains an entry for ID with the passed phidget reference number.
Available events:
Device Class | Event | Parameters |
All devices | Attach | - |
Detach | - | |
PropertyChange | property | |
Error | errorString, errorCode | |
Accelerometer | AccelerationChange | timestamp, acceleration |
BLDCMotor | BrakingStrengthChange | brakingStrength |
PositionChange | position | |
VelocityUpdate | velocity | |
CapacitiveTouch | Touch | touchValue |
TouchEnd | ||
CurrentInput | CurrentChange | current |
DCMotor | BackEMFChange | backEMF |
BrakingStrengthChange | brakingStrength | |
VelocityUpdate | velocity | |
Dictionary | - | - |
DigitalInput | StateChange | state |
DigitalOutput | - | - |
DistanceSensor | DistanceChange | distance |
SonarReflectionsUpdate | count, distances, amplitudes | |
Encoder | PositionChange | positionChange, timeChange, indexTriggered |
FrequencyCounter | CountChange | counts, timeChange |
FrequencyChange | frequency | |
GPS | HeadingChange | heading, velocity |
PositionChange | latitude, longitude, altitude | |
PositionFixStateChange | positionFixState | |
Gyroscope | AngularRateUpdate | timestamp, angularRate |
Hub | - | - |
HumiditySensor. | HumidityChange | humidity |
IR | Code | code, bitcount, isRepeat |
Learn | code, codeInfo | |
RawData | data, dataLen | |
LCD | - | - |
LightSensor | IlluminanceChange | illuminance |
Magnetometer | MagneticFieldChange | timestamp, magneticField |
MotorPositionController | PositionChange | position |
DutyCycleUpdate | dutyCycle | |
PHSensor | PHChange | ph |
PowerGuard | - | - |
PressureSensor | PressureChange | pressure |
RCServo | PositionChange | position |
TargetPositionReached | position | |
VelocityChange | velocity | |
ResistanceInput | ResistanceChange | resistance |
RFID | Tag | tag, protocool |
TagLost | tag, protocool | |
SoundSensor | SPLChange | dB, dBA, dBC, octaves |
Spatial | AlgorithmData | timestamp, quaternion |
SpatialData | timestamp, acceleration, angularRate, magneticField | |
Stepper | PositionChange | position |
Stopped | - | |
VelocityChange | velocity | |
TemperatureSensor | TemperatureChange | temperature |
VoltageInput | SensorChange | sensorValue, sensorUnit |
VoltageChange | voltage | |
VoltageOutput | - | - |
VoltageRatioInput | SensorChange | sensorValue, sensorUnit |
VoltageChange | voltageRatio |
We queue triggers and fire them when FileMaker is not busy. If the device sends too many events, we may discard in-between ones and only deliver the last event. This way you can process measurements as fast as you can, but we don't overload FileMaker.
With plugin version 6.0 or newer the script name can be a script ID number. In that case the plugin queries the script name for the given script ID. This allows to call scripts by ID and avoid problems if scripts are later renamed.
Notice: FileMaker 19.2 adds a fmplugin extended privileges. If you have such an extended privileges to allow the plugin to trigger scripts, you need to grant permissions for it. If such a privilege is not defined, the plugin is allowed to trigger scripts. See FileMaker product documentation for details.
Examples
Set attach and detach script triggers:
Set Variable [ $r ; Value: MBS( "Phidget.SetScriptTrigger"; $$phidget; "Attach"; Get(FileName); "Attached" ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetScriptTrigger"; $$phidget; "Detach"; Get(FileName); "Detached" ) ]
Set trigger for temperature changing
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "DataInterval"; 1000 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "TemperatureChangeTrigger"; ,1 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetScriptTrigger"; $phidget; "TemperatureChange"; Get(FileName); "TemperatureChange" ) ]
Set IlluminanceChange trigger:
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "DataInterval"; 2000 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "IlluminanceChangeTrigger"; 10 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetScriptTrigger"; $phidget; "IlluminanceChange"; Get(FileName); "IlluminanceChange" ) ]
Set HumidityChange trigger:
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "DataInterval"; 2000 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetProperty"; $phidget; "HumidityChangeTrigger"; 1 ) ]
Set Variable [ $r ; Value: MBS( "Phidget.SetScriptTrigger"; $phidget; "HumidityChange"; Get(FileName); "HumidityChange" ) ]
See also
Example Databases
- Phidgets/Phidget Barometer
- Phidgets/Phidget Digital Outputs
- Phidgets/Phidget Distance Sensor
- Phidgets/Phidget IR Receiver
- Phidgets/Phidget LCD
- Phidgets/Phidget Light Sensor
- Phidgets/Phidget Temperator Sensor
- Phidgets/Phidget Voltage Input
Blog Entries
This function is free to use.
Created 16th August 2023, last changed 12nd January 2024