$i = WinGetProcess("Youtube - Microsoft Edge")
Consolewrite($i)
I first used this script(1)^ to get the PID, and confirmed PID with following script(2):
$wintitleProcess = _WinGetByPID(12724)
MsgBox(0,"my Name",$wintitleProcess)
;Smoke_N's WinGetByPID
Func _WinGetByPID($iPID, $nArray = 1);0 will return 1 base array; leaving it 1 will return the first visible window it finds
If IsString($iPID) Then $iPID = ProcessExists($iPID)
Local $aWList = WinList(), $sHold
For $iCC = 1 To $aWList[0][0]
If WinGetProcess($aWList[$iCC][1]) = $iPID And _
BitAND(WinGetState($aWList[$iCC][1]), 2) Then
If $nArray Then Return $aWList[$iCC][0]
$sHold &= $aWList[$iCC][0] & Chr(1)
EndIf
Next
If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
Return SetError(1, 0, 0)
EndFunc
Func terminate()
exit
EndFunc
Script (2) shows that particular window as being PID 12724, while the sound detection script returns PID as 5880.
When I input 5880 into script(2), the MsgBox returns 0. When I input 12724 into script (2), the MsgBox returns "Youtube - Microsoft Edge" (correctly)