Script Development Guide
To create a custom script for Seer, you must define the metadata and implement the corresponding functional logic.
1. Defining Script Metadata
Seer initializes scripts by looking for a SCRIPT_INFO dictionary or a script_info() function within your script.
Required Fields
name: Display name of the script.type: The functional category:0: Preview1: Controls2: Property
extensions: A list of file extensions (strings). Use${type_folder}for directory matching.arguments: A list of CLI arguments (excludepython.exeand the script filename).
Example Definition
SCRIPT_INFO = {
"name": "unzip",
"type": 1,
"extensions": ["zip", "rar", "7z"],
"arguments": ["-e", "${7z}", "-i", "${input_file}", "-o", __save_path, "-w"],
# Optional metadata
"author": "YourName",
"version": "1.0.1",
"description": "Short description of the script",
"icon_path": "icon.png", # Controls type only
}
2. Feature Implementation
- Preview (Type 0): Loads/parses the input file and converts it into a format supported natively by Seer (e.g., PDF, image, or HTML).
-
Example: Converting an
.epubfile to.html. -
Controls (Type 1): Adds a button to the left side of the Control Bar. Clicking it executes the defined script.
-
Example: Compressing the currently previewed folder into a
.zipfile. -
Property (Type 2): Seer automatically executes the script upon successful file loading. The script must write metadata to a JSON file at the location specified by
${output_file}. Seer then reads and displays this JSON content. - Example: Calculating the SHA512 hash of a file.
3. Available Variables
These tokens are dynamically replaced by Seer and passed as command-line arguments:
| Variable | Description |
|---|---|
${7z} |
Absolute path to Seer's bundled 7z.exe. |
${seer_exe} |
Absolute path to Seer.exe. |
${seer_dir} |
Directory containing Seer.exe. |
${input_file} |
Path to the target file/folder currently being previewed. |
${output_file} |
Path to the temporary output file (required for Property and some Preview scripts). |
${no_cache} |
Preview only: Flag to instruct Seer to delete the temporary file after the preview closes (not passed to the script as an argument). |
${type_folder} |
Controls only: Used to match directory types. |
${use_backslash} |
Use \ instead of / for path separators. |
Note:
${no_cache}is an internal flag for Seer and is not passed to your script as a command-line argument.