@echo off
setlocal
title Loop - Arranque automatico
echo.
echo LOOP - Configuracion de la computadora conectada al LED
echo Este configurador crea un acceso en Inicio de Windows para este usuario.
echo No cambia el inicio de sesion ni la configuracion de otras aplicaciones.
echo.
powershell.exe -NoProfile -Command "$ErrorActionPreference='Stop'; Add-Type -AssemblyName System.Windows.Forms; $monitors=[System.Windows.Forms.Screen]::AllScreens; for($i=0;$i -lt $monitors.Count;$i++){ $b=$monitors[$i].Bounds; Write-Host (($i+1).ToString()+'. '+$monitors[$i].DeviceName+' - '+$b.Width+' x '+$b.Height+' - posicion '+$b.X+','+$b.Y) }; $pick=0; $answer=Read-Host 'Numero del monitor conectado al LED'; if(-not [int]::TryParse($answer,[ref]$pick) -or $pick -lt 1 -or $pick -gt $monitors.Count){throw 'Monitor no valido. Ejecuta de nuevo el configurador.'}; $bounds=$monitors[$pick-1].Bounds; $edge=@((${env:ProgramFiles(x86)}+'\Microsoft\Edge\Application\msedge.exe'),($env:ProgramFiles+'\Microsoft\Edge\Application\msedge.exe'),($env:LOCALAPPDATA+'\Microsoft\Edge\Application\msedge.exe')) | Where-Object {Test-Path -LiteralPath $_} | Select-Object -First 1; if(-not $edge){throw 'Instala Microsoft Edge desde su sitio oficial y vuelve a intentar.'}; $profile=Join-Path $env:LOCALAPPDATA 'LoopPlayer'; New-Item -ItemType Directory -Path $profile -Force | Out-Null; $arguments='--user-data-dir='+[char]34+$profile+[char]34+' --no-first-run --start-fullscreen --window-position='+$bounds.X+','+$bounds.Y+' --window-size='+$bounds.Width+','+$bounds.Height+' --app=https://loopsigns.tech/player.html?autostart=1'; $shell=New-Object -ComObject WScript.Shell; foreach($folder in @([Environment]::GetFolderPath('Startup'),[Environment]::GetFolderPath('Desktop'))){$link=$shell.CreateShortcut((Join-Path $folder 'Loop Player.lnk'));$link.TargetPath=$edge;$link.Arguments=$arguments;$link.WorkingDirectory=Split-Path $edge;$link.Description='Loop - Reproduccion automatica en el LED';$link.Save()}; Write-Host 'Listo. Loop abrira automaticamente al iniciar sesion de Windows.' -ForegroundColor Green; Write-Host 'Vincula el codigo fijo una sola vez en la ventana que se abrira.'; Write-Host 'Para desactivar el arranque elimina Loop Player de la carpeta Inicio de Windows.'; Start-Process -FilePath $edge -ArgumentList $arguments"
if errorlevel 1 echo No se completo la configuracion. Revisa el mensaje anterior.
echo.
pause
