One of the things this script does is detects when Netflix has gone fullscreen and sends it to my secondary monitor. The problem is that with any sleep added to the loop the WinMove resize breaks and leaves the video at the 1st screen's resolution. Do I even need sleep in the loop? I remember having issues with sleepless loops, so I'm hesitant to leave it like this even though it appears to work fine without it.
*Edit - It's worth mentioning that it's not my $SecondDesktopWidth variable that's causing issues, as I have the same problem when I put the exact desktop resolution in.
Plain Text
$aTSR = _GetTotalScreenResolution() $SecondDesktopWidth = $aTSR[0] - @DesktopWidth $key="HKEY_CURRENT_USER\Control Panel\Desktop" $value="ScreenSaveActive" Run(@comspec & ' /c "C:\Users\...\AppData\Local\Google\Chrome\Application\chrome.exe" --kiosk netflix.com') RegWrite($key, $value, "REG_SZ", 0) WinWait("Netflix") While 1 If WinExists("Microsoft Silverlight") Then $size = WinGetClientSize('Microsoft Silverlight') If $size[0] = @DesktopWidth And $size[1] = @DesktopHeight Then Opt("WinTitleMatchMode", 1) WinMove("Microsoft Silverlight", "", @DesktopWidth, 0,$SecondDesktopWidth) WinWaitClose("Microsoft Silverlight") EndIf EndIf If WinExists("Netflix") Then Else Sleep(1000) ;wait and check again to see if Netflix is really closed If WinExists("Netflix") Then Else OnAutoItExitRegister ("TurnSS_ON") Exit EndIf EndIf ;Sleep(100) ;if added will break WinMove resize WEnd Func TurnSS_ON() RegWrite($key, $value, "REG_SZ", 1) EndFunc Func _GetTotalScreenResolution() Local $aRet[2] Global Const $SM_VIRTUALWIDTH = 78 Global Const $SM_VIRTUALHEIGHT = 79 $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALWIDTH) $aRet[0] = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", $SM_VIRTUALHEIGHT) $aRet[1] = $VirtualDesktopHeight[0] Return $aRet EndFunc