Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
test3
# --- Dimensions des écrans --- $screenWidth = 2560 $screenHeight = 1440 # --- Ajouter MoveWindow --- Add-Type @" using System; using System.Runtime.InteropServices; public class WinAPI { [DllImport("user32.dll")] public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); } "@ # --- Ajouter SendKeys pour F11 --- Add-Type -AssemblyName System.Windows.Forms # --- Lancer Edge et déplacer les fenêtres --- for ($i=0; $i -lt $urls.Count; $i++) { # Lancer Edge normalement (pas kiosk) $process = Start-Process "msedge.exe" -ArgumentList "$($urls[$i])" -PassThru # --- Attendre que la fenêtre existe --- $hwnd = 0 $tries = 0 while (($hwnd -eq 0) -and ($tries -lt 20)) { Start-Sleep -Milliseconds 500 $hwnd = $process.MainWindowHandle $tries++ } if ($hwnd -eq 0) { Write-Host "Impossible de récupérer la fenêtre Edge pour $($urls[$i])" continue } # --- Déplacer la fenêtre sur le bon écran --- $x = $i * $screenWidth $y = 0 $result = [WinAPI]::MoveWindow($hwnd, $x, $y, $screenWidth, $screenHeight, $true) if (-not $result) { Write-Host "Échec du déplacement de la fenêtre $($urls[$i])" } else { Write-Host "Fenêtre $($urls[$i]) placée sur l'écran $($i+1)" } # --- Attendre un peu pour que la fenêtre soit active --- Start-Sleep -Milliseconds 500 # --- Mettre en plein écran (F11) --- [System.Windows.Forms.SendKeys]::SendWait("{F11}") Start-Sleep -Milliseconds 500 } Write-Host "Mur d'écrans initialisé !"
Créé il y a 1 semaine.