@echo off
rem Evie laptop helper setup (from https://evie-assistant.pages.dev/guide).
rem Puts one small script in %LocalAppData%\Evie and a shortcut "Evie laptop helper" in the Startup folder so it
rem starts when you sign in to Windows. The script lets Evie, open on THIS laptop, open a few named apps, open web
rem addresses, press the volume / media keys and lock the screen - nothing else. It cannot be reached from other devices.
rem To undo: delete "Evie laptop helper" from the Startup folder (Windows+R, shell:startup) and the folder %LocalAppData%\Evie.
title Evie laptop helper setup
set "EVIE_URL=https://evie-assistant.pages.dev/"
echo.
echo   Setting up the Evie laptop helper...
powershell -NoProfile -ExecutionPolicy Bypass -Command "$dir = Join-Path $env:LocalAppData 'Evie'; New-Item -ItemType Directory -Force -Path $dir | Out-Null; $ps = Join-Path $dir 'Evie-Laptop.ps1'; Invoke-WebRequest -UseBasicParsing -Uri ($env:EVIE_URL + 'Evie-Laptop.ps1') -OutFile $ps; $sh = New-Object -ComObject WScript.Shell; $lnk = $sh.CreateShortcut((Join-Path ([Environment]::GetFolderPath('Startup')) 'Evie laptop helper.lnk')); $lnk.TargetPath = (Join-Path $env:SystemRoot 'System32\WindowsPowerShell\v1.0\powershell.exe'); $lnk.Arguments = '-NoProfile -WindowStyle Hidden -ExecutionPolicy Bypass -File \"' + $ps + '\"'; $lnk.WindowStyle = 7; $lnk.Description = 'Evie laptop helper'; $lnk.Save(); Start-Process -FilePath $lnk.TargetPath -ArgumentList $lnk.Arguments -WindowStyle Hidden; Start-Sleep -Seconds 3; if (-not (Test-Path (Join-Path $dir 'pair-code.txt'))) { exit 1 }"
if errorlevel 1 goto failed
echo.
echo   Done. The helper is running and will start by itself when you sign in to Windows.
echo.
echo   Your pairing code is:
echo.
type "%LocalAppData%\Evie\pair-code.txt"
echo.
echo   In Evie: menu - Settings - "Laptop control" - Connect, and type this code. Keep it to yourself.
echo.
pause
exit /b 0
:failed
echo.
echo   The helper could not be set up. Nothing was changed that needs undoing.
echo.
pause
exit /b 1
