' Qserve Print Agent — start in the BACKGROUND with no console window.
'
' First-time setup: run the agent .exe normally ONCE and paste your token
' (that writes the .env config). After that, use this launcher to run it
' hidden. To auto-start on login: press Win+R, type  shell:startup , and put
' a shortcut to THIS file in the folder that opens.
'
' It finds the print-agent .exe next to this script and launches it with a
' hidden window (0) without waiting (False).
Set fso = CreateObject("Scripting.FileSystemObject")
Set sh  = CreateObject("WScript.Shell")
folder  = fso.GetParentFolderName(WScript.ScriptFullName)
For Each f In fso.GetFolder(folder).Files
  If LCase(fso.GetExtensionName(f.Name)) = "exe" And InStr(LCase(f.Name), "print") > 0 Then
    sh.CurrentDirectory = folder
    sh.Run """" & f.Path & """", 0, False
    Exit For
  End If
Next
