[Solved]Setting Window Position (Opera 33)
-
dacke9000 last edited by
I would very much like to know how I can reposition the Opera window position on my computer before startup. I have a laptop and have very different screen dimensions when I'm docked. I want my window positioned and sized one way when I'm docked at work and another when I'm mobile.
I can't seem to find any registry values in order to do this and when I attempt to programmatically set the values using the SetWindowPos function from User32.dll it fails. I think that this is because Opera creates an executable for every window that it has open.
Yes I know that I can just position the window myself with the mouse, but I have all of my other programs scripted to open and position themselves for my different profiles using a PowerShell script. It would be helpful if I could include Opera as well.
-
A Former User last edited by
Can PowerShell identify a windows by its title (like AutoIt can) instead of its executable?
-
dacke9000 last edited by
Thank you for the push in the right direction. As far as Get-Process goes it will return to me all 6 processes (if I have 6 tabs open) but only one of them has the MainWindowTitle value set. Here is the PowerShell code that I am using to script all of my information. Hopefully it will help another.
function GetWindowProcess() { Param([Parameter(Mandatory=$true, HelpMessage="The name of the process in memory (ps-list).`n")] [string] $processName, [Parameter(Mandatory=$false, HelpMessage="True if you want to only affect the process with a Main Window Title (default false).`n")] [bool] $useMainWindowTitle = $false) if ($useMainWindowTitle) { return (Get-Process | Where { $_.MainWindowTitle -and $_.Name -eq $processName }) } else { return Get-Process -Name $processName } } [System.Diagnostics.Process] $proc = GetWindowProcess -processName 'opera' -useMainWindowTitle $true
Now that I have the window process I can get it's MainWindowHandle and affect it with the aforementioned SetWindowPos function. Thanks! :yes: