Run Script on Property Edit
pendingby David Whittam
Detects when YAML frontmatter properties are edited and runs supplied scripts.
Run Script on Property Edit
An Obsidian plugin that detects when YAML frontmatter properties are edited and automatically runs specified scripts.
Usage
- Go to Settings → Community Plugins → Run Script on Property Edit
- Click "Add new property rule"
- Configure your rule:
- Property name: The frontmatter property to watch (e.g.,
status,closed,tags) - Script path: Full path to your script (e.g.,
C:\Scripts\my-script.bator/usr/local/bin/my-script.sh) (haven't tested with a .sh) - Show notification: Toggle to show a notification when the script runs
- Property name: The frontmatter property to watch (e.g.,
- Enable the rule
- Edit the property in any note's frontmatter to trigger the script
Environment Variables
Your script receives these environment variables:
PROPERTY_NAME- Name of the edited propertyPROPERTY_VALUE- New value of the propertyPREVIOUS_VALUE- Previous value of the property (this will be blank unless changed previously in the same obsidian instance)FILE_PATH- Path to the file (relative to vault)FILE_NAME- Name of the fileVAULT_PATH- Full path to the vault
Example
Watch for a closed property and move the file when set to true:
@echo off
if /I "%PROPERTY_VALUE%"=="true" (
move "%VAULT_PATH%\%FILE_PATH%" "C:\Archive\%FILE_NAME%"
)
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.