I've cobbled up a quick powershell script for the purpose when I got my Duet. It watches a folder for new/changed .gcode files and offers to upload them.
# adjust these to your values
$folder = "e:\3dprint\gcodes"
$filter = "*.gcode"
$Global:baseUri = "http://duet3d.local/rr_upload?name=gcodes/"
Add-Type -AssemblyName PresentationCore,PresentationFramework
$Global:lastPath = ''
$Global:lastTime = Get-Date
$Watcher = New-Object IO.FileSystemWatcher $folder, $filter -Property @{
IncludeSubdirectories = $false
NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'
}
$changeAction = [scriptblock]::Create('
$path = $Event.SourceEventArgs.FullPath
$name = $Event.SourceEventArgs.Name
$timeGenerated = $Event.TimeGenerated
# usually multile change events are triggered when a file is written, no need to spam those
if ($Global:lastPath -ne $path -or ($Global:lastTime - $timeGenerated).TotalSeconds -lt -10) {
$Global:lastPath = $path;
$Global:lastTime = $timeGenerated
$msgBoxResult = [System.Windows.MessageBox]::Show(("Upload `"{0}`" to the printer?" -f $Event.SourceEventArgs.Name),"GCode Upload","YesNo","Question")
switch ($msgBoxResult) {
"Yes" {
try {
Invoke-WebRequest -Uri ("{0}{1}" -f $baseUri, $name) -Method Post -InFile $path
} catch {
}
}
"No" {
}
}
}
')
$onChanged = Register-ObjectEvent $Watcher Changed -SourceIdentifier FileChanged -Action $changeAction
# prevent the console from closing
while (1) {
sleep 2
}
Save somewhere with .ps1 extension and edit line 2-4 to match your settings. To run it rightclick the file -> "Run with PowerShell" and leave the powershell window open. To trigger the upload question just save your gcode file into the folder you specified in line 2.