I’m trying to run Rhino + python script using Task Scheduler using the following syntax:
“C:\Program Files\Rhino 8\System\Rhino.exe” /nosplash /runscript=“_-RunPythonScript ‘C:\Users\me\Company Name With Spaces\Folder Name With Spaces\PythonScript.py’”
I put the file path in single quotes since the larger RunPythonScript argument is in double quotes, but when Rhino opens and tries to RunPythonScript it still sees the whitespace as Enter.
I need to do some file format conversions (SVG to DXF) every day in perpetuity. I have a py script that works great in Rhino, and so this was the path of least resistance (especially considering i am working in a corporate environment with tight I. T. oversight).
I definitely will be learning how to properly run Rhino headless with standalone python, but for now, this does the trick.
This stuff is new to me. I have never tried Task Scheduler before.
Can I set up a task to run a python script in rhino (like you showed above) when ever a file is moved to a folder?
Can the Task Scheduler do stuff like that? Or do I have to set it up to process all files in a given folder at a given time?
Sorry for the noob questions, and I could probably google this stuff, or ask ChatGpt, but I am so old that I still prefer human interaction
Thanks, I’ll look into it. I did ask ChatGpt though and here is the answer.
I have not tested this at all, so use the example method at own risk:
ChatGPT's answer
You can use Task Scheduler in Windows to automate an action when a file appears in a specific folder. However, Task Scheduler alone does not have a built-in way to monitor folders. To achieve this, you need to combine it with a PowerShell script that watches for new files and triggers an event.
Method 1: Task Scheduler + PowerShell
This method uses a PowerShell script to monitor a folder. When a new file appears, the script triggers an action.
1. Create a PowerShell Script
Create a new file called MonitorFolder.ps1 and add the following script:
$folderPath = "C:\Path\To\Watched\Folder"
$fileFilter = "*.*" # Monitors all file types
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.Path = $folderPath
$watcher.Filter = $fileFilter
$watcher.IncludeSubdirectories = $false
$watcher.EnableRaisingEvents = $true
Register-ObjectEvent $watcher "Created" -Action {
Start-Process "C:\Path\To\ProgramOrScript.exe" # Replace with the action you want to perform
}
while ($true) { Start-Sleep 10 } # Keeps the script running
This script continuously monitors the folder for new files and executes a program or script when a file is added.
2. Schedule the Script to Run at Startup
Open Task Scheduler (Win + R, type taskschd.msc, press Enter).
Click Create Basic Task (on the right panel).
Give it a name (e.g., “Monitor Folder Task”), then click Next.