I have a function which makes a window -a TOPMOST window.
So - I can run this :
Get-WindowByProcessTitle *chrome* | Set-TopMost
Notice the argument here is a process name ( "chrome"
is in "chrome.exe"
which is the process).
The inner code which finally selects the process is :
Get-Process | Where-Object {$_.MainWindowTitle -like "*chrome*"} | Select-Object Id,Name,MainWindowHandle,MainWindowTitle
Great.
Question
Now I have a query which select a window
according to its title
:
Select-Window *chrome* | Where {$_.Title -like "*$WindowTitle*"} | Select-Object -first 1
Which yields :
ProcessName : chrome
ProcessId : 3972
IsActive : False
Handle : 1641684
Title : Watch Full movie The Beach (2000) Online Free | FFilms.org - Google Chrome
Class : Chrome_WidgetWin_1
How can I get the process object ( not the ProcessId) from this query of mine ?
I think I need something like : (psuedo)
Select-Window *chrome* | Where {$_.Title -like "*$WindowTitle*"} |What_Is_MyProcess_Object? |Select-Object Id,Name,MainWindowHandle,MainWindowTitle