Pagina 1 di 1

[Risolto] Macro per Ridurre finestra Browser

Inviato: martedì 13 febbraio 2024, 9:42
da Barakkino
Ciao,
in una ricerca on line ho trovato questo codice, ma non funziona. E' una cavolata o si può correggere?

Codice: Seleziona tutto

Sub RiduciFinestraBrowser
    Dim command As String
    
    command = "Add-Type -AssemblyName System.Windows.Forms; " & _
              "$process = Get-Process -Name chrome | Where-Object {$_.MainWindowTitle -ne ''}; " & _
              "$window = $process.MainWindowHandle; " & _
              "$rect = New-Object System.Drawing.Rectangle; " & _
              "$result = [System.Windows.Forms.NativeMethods]::GetWindowRect($window, [ref]$rect); " & _
              "$width = ($rect.Width / 2); " & _
              "[System.Windows.Forms.NativeMethods]::MoveWindow($window, $rect.X, $rect.Y, $width, $rect.Height, $true); "
    
    Shell "powershell.exe -Command """ & command & """", 1
End Sub