Firstly... this program creates a slideshow on a secondary monitor, as well as a screensaver slideshow on the primary monitor.
It's a bit overwhelming if you just dive into it, but it's coded fairly easy and there are comments to explain what's going on.
I have 2 annoying errors.
Error 1: Lines 136 - 141
For some reason, it doesn't reset the txt file.
Minor annoyance, it just causes my logs to be very large at times so they open slow and are hard to scroll through.
Error 2: Lines 1039 - 1067
I'll explain what's going on in this...
System Idle alone isn't enough to tell the screensaver not to run. It doesn't account for videos (youtube, Netflix, etc)
So, to combat this... Several screenshots are taken of the screen, then compared to the current screen. This will tell the program if the screen is changing.
My error is that sometimes it will properly take screenshots and all is well, and sometimes it won't. The workaround is to check if the screenshots have been taken, and then skip the comparison if they have not.
My workaround still has issues sometimes, which I'm working on -.-
Memo: I notice the errors with the compiled script. I'm not sure if the same thing happens when running straight from the au3
LogProgram("=CaptureScreen=") $currentShot = 1 LogProgram("ssRows: " & $ssRows) LogProgram("ssColumns: " & $ssColumns) LogProgram("currentShot: " & $currentShot) ;Vertical LogProgram("currentYpos: " & $currentYpos) ;Horizontal LogProgram("currentXpos: " & $currentXpos) ($incrementX * $currentXpos), _ ($incrementY * $currentYpos), _ ($incrementX * ($currentXpos + 1)), _ $incrementY * ($currentYpos + 1), 0) LogProgram("screensaver " & $currentShot & ".bmp saved") LogProgram("screensaver " & $currentShot & ".bmp save error") $captureError = 1 $currentShot += 1 LogProgram("currentShot: " & $currentShot) Next ;x Next ;y
Whole Program:
#include <File.au3> #include <GetFileProperty.au3> #include <GUIConstantsEx.au3> #include <Misc.au3> #include <Timers.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Array.au3> #include <ImageSearch.au3> #include <ScreenCapture.au3> #include <GDIPlus.au3> #include <Date.au3> ;Find Log File information ;Only allow one instance of the program to run. ;Settings ;==================================== ;Can be edited via external text file (FSS.txt) GetSettings() ;==================================== Global $desktop $smPicName, $activeWindowPosition, $smRefreshImage, $smImageChangeTimer, $smSSMTimer, _ $startWithWindows, $closeWithScreensaver, $smPic, $smGdiPic, $position $pmPicName, $pmSSTimer, $pmPic, $pmGdiPic, $pmSSChangeTimer, $blinkTaskbar, $forceFSSOn ;Prevents CloseProgram() function on startup ;Preliminary setup - Creates GUI, displays 1 image ;==================================== GetImageForDisplaySM() GetImageForDisplayPM() CreateGUI() MoveGUIWindow() ShowImageSM() ShowImagePM() ;Main Program ;==================================== While 1 ;Debug ;~ ToolTip(CheckIfFSSshouldDisplay() & @CRLF & _ ;~ "Active: " & $activeWindowPosition[0] & ", " & $activeWindowPosition[1] & @CRLF & _ ;~ "Mouse: " & MouseGetPos(0) & ", " & MouseGetPos(1) & @CRLF & _ ;~ "Desktop: " & $desktop & @CRLF & _ ;~ "Monitor: " & @DesktopWidth & "x" & @DesktopHeight _ ;~ , 100, 5) ;====== ;~ Local $temp = _Timer_GetIdleTime() ;~ ToolTip("SS: " & $screenSaverIsOn & @CRLF & "Idle: " & $temp, 100, 5) ;========================== ;These functions are set in settings (FSS.txt) ShowTrayIcon() ;Should Tray Icon be shown? StartWithWindows() ;Start program with Windows? (doesn't function) ;================ AlwaysOnTop() ;Force slideshow to be on top of other windows LoseFocus() ;Lose focus in case slideshow becomes the active window ;Should Fullscreen Slideshow be on or off ShowFSS() HideFSS() ScreensaverOperations() ChangeImageSM() DisplayTaskbar() CloseProgram() ;Only every 5 times LogProgram("Loop Count: " & $LoopCount) $LoopCount = 1 ;Pre-cautionary in case of changes in Monitor dimensions (if secondary monitor is unplugged) MoveGUIWindow() ;Check settings for changes GetSettings() $LoopCount += 1 ;Allow CPU to rest ;Beginning of Functions ;==================================== LogProgram("=Get Settings=") LogProgram("lineNumber: " & $lineNumber) ;Move to the Fullscreen Slideshow Section LogProgram("lineNumber: " & $lineNumber) LogProgram("line: " & $line) $lineNumber += 1 ;Read until the next section ;Split line by Description and value $description = $lineSplit[1] $value = $lineSplit[2] LogProgram("Picture Folder: " & $value) $pictureFolder = $value LogProgram("Show Tray Icon: " & $value) LogProgram("SM Width: " & $value) LogProgram("SM Height: " & $value) LogProgram("SM Position: " & $value) LogProgram("SM Activation Mode: " & $value) LogProgram("SMSSM Seconds: " & $value) $smSSMsec = $smSSMsec * 1000 ;Convert to milliseconds LogProgram("SM Change Method: " & $value) LogProgram("SM Image Change Seconds: " & $value) $smImageChangeSec = $smImageChangeSec * 1000 ;Convert to milliseconds LogProgram("SM Image Order: " & $value) LogProgram("Taskbar Size: " & $value) LogProgram("Start with Windows: " & $value) $lineNumber += 1 $lineNumber += 2 ;Move past 'Fullscreen Screensaver' line ;Read until the next section LogProgram("lineNumber: " & $lineNumber) LogProgram("line: " & $line) ;Split line by Description and value $description = $lineSplit[1] $value = $lineSplit[2] LogProgram("Screensaver Turned On?: " & $value) LogProgram("Screensaver Activation Seconds: " & $value) $pmSSActivationSec = $pmSSActivationSec * 1000 ;Convert to milliseconds LogProgram("Screensaver Image Change Seconds: " & $value) $pmSSChangeImageSec = $pmSSChangeImageSec * 1000 ;Convert to milliseconds $taskbarBlinkSec = $taskbarBlinkSec * 1000 ;Convert to milliseconds LogProgram("Rows: " & $value) LogProgram("Columns: " & $value) LogProgram("Change %: " & $value) LogProgram("Check Count: " & $value) $lineNumber += 1 EndFunc ;==>GetSettings LogProgram("=GetImageForDisplaySM=") ;Check image folder for count change LogProgram("=GetImageForDisplaySM calling=") CheckForImageChanges() ;Throw away value to prevent error with GetDimensions ;Secondary Monitor ;Images should go in order by file LogProgram("Image Order:" & $smImageOrder) ;Counted Images default is 0 $countedImages += 1 ;If the the counted images surpasses the number of images that are there, then reset the count $countedImages = 1 $smPicName = $countedImages ;Select a random image from the list ;Select a random image from the list ;Select a random image, but do not show the same image twice Else ;$smImageOrder = "Random No Repeat" $reset = 0 $resetCount = 0 $imageShown[$x] = "" ;Check if image has been shown $imageWasShown = 1 Next ;y $imageWasShown = 0 $newPic = 0 $newPic = 1 $resetCount += 1 $reset = 1 ;Save image to shown image list ;Store name in next available empty slot $imageShown[$x] = $smPicName ;Save image to shown image list ExitLoop ;End loop early LogProgram("(SM) Selected Image SM: " & $imageList[$smPicName]) LogProgram("(SM - Throw Away)Selected Image PM: " & $imageList[$pmPicName]) ;Get Dimensions of image LogProgram("=GetImageForDisplaySM calling=") GetDimensions($imageList[$smPicName], $imageList[$pmPicName]) $smImageHeight = $smpHeight $smImageWidth = $smpWidth ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing) LogProgram("Pre-Adjust") LogProgram("smImageHeight: " & $smImageHeight) LogProgram("smImageWidth: " & $smImageWidth) LogProgram("smHeight: " & $smHeight) LogProgram("smWidth: " & $smWidth) ;Adjust the image size ;----------------------------------------------- ;If the image is bigger than the screen, adjust it ;Get aspect ratio $aspectRatioX = $smWidth / $smImageWidth ;Aspect ratio = monitor horizontal / image X $aspectRatioY = $smHeight / $smImageHeight ;Aspect ratio = monitor vertical / image Y LogProgram("aspectRatioX: " & $aspectRatioX) LogProgram("aspectRatioY: " & $aspectRatioY) LogProgram("Image is Wide") ;New Height $smImageHeight = $smWidth * ($smImageHeight / $smImageWidth) $smImageWidth = $smWidth LogProgram("New smImageHeight: " & $smImageHeight) LogProgram("New smImageWidth: " & $smImageWidth) LogProgram("Image is Tall") ;New Width $smImageWidth = $smHeight * ($smImageWidth / $smImageHeight) $smImageHeight = $smHeight LogProgram("New smImageHeight: " & $smImageHeight) LogProgram("New smImageWidth: " & $smImageWidth) LogProgram("Image is smaller/same size as monitor") ;Calculate Center of monitor ;(Monitor size - image size) / 2 $smCenterX = ($smWidth - $smImageWidth) / 2 $smCenterY = ($smHeight - $smImageHeight) / 2 LogProgram("smCenterX: " & $smCenterX) LogProgram("smCenterY: " & $smCenterY) ;Resize the image LogProgram("Resize Image SM") $smhHBmp = $pictureFolder & "\" & $imageList[$smPicName] EndFunc ;==>GetImageForDisplaySM LogProgram("=GetImageForDisplayPM=") ;Check image folder for count change LogProgram("=GetImageForDisplayPM calling=") CheckForImageChanges() $pmChangeImage = 0 LogProgram("(PM - Throw Away) Selected Image SM: " & $imageList[$smPicName]) LogProgram("(PM)Selected Image PM: " & $imageList[$pmPicName]) ;Get Dimensions of image LogProgram("=GetImageForDisplayPM calling=") GetDimensions($imageList[$smPicName], $imageList[$pmPicName]) $pmImageHeight = $pmpHeight $pmImageWidth = $pmpWidth ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing) LogProgram("Pre-Adjust") LogProgram("pmImageHeight: " & $pmImageHeight) LogProgram("pmImageWidth: " & $pmImageWidth) ;Adjust the image size ;----------------------------------------------- ;If the image is bigger than the screen, adjust it ;Get aspect ratio LogProgram("aspectRatioX: " & $aspectRatioX) LogProgram("aspectRatioY: " & $aspectRatioY) LogProgram("Image is Wide") ;New Height LogProgram("New pmImageHeight: " & $pmImageHeight) LogProgram("New pmImageWidth: " & $pmImageWidth) LogProgram("Image is Tall") ;New Width LogProgram("New pmImageHeight: " & $pmImageHeight) LogProgram("New pmImageWidth: " & $pmImageWidth) LogProgram("Image is smaller/same size as monitor") ;Calculate Center of monitor ;(Monitor size - image size) / 2 LogProgram("pmCenterX: " & $pmCenterX) LogProgram("pmCenterY: " & $pmCenterY) ;Resize the image LogProgram("Resize Image PM") $pmhHBmp = $pictureFolder & "\" & $imageList[$pmPicName] EndFunc ;==>GetImageForDisplayPM LogProgram("=GetDimensions=") ;Secondary Monitor LogProgram("-Secondary Monitor-") $path = $pictureFolder & "\" & $smPicName LogProgram("Path: " & $path) LogProgram("File Size: " & $fileSize) LogProgram("Registry Size: " & RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Size")) ;Save information to registry for faster access. Compare size of picture to verify changes to picture LogProgram("File Sizes Do Not Match") RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Size", "REG_SZ", $fileSize) ;~ $prop = _GetFileProperty($path, "Dimensions") ;~ $dArray = StringSplit($prop, " x ") ;~ $smpWidth = Number(StringMid($dArray[1], 2)) ;~ $smpHeight = Number($dArray[4]) RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Width", "REG_SZ", $smpWidth) RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Height", "REG_SZ", $smpHeight) LogProgram("File Sizes Match") $smpWidth = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Width") $smpHeight = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $smPicName & " Height") LogProgram("smpWidth: " & $smpWidth) LogProgram("smpHeight: " & $smpHeight) ;Primary Monitor LogProgram("-Primary Monitor-") $path = $pictureFolder & "\" & $pmPicName LogProgram("Path: " & $path) LogProgram("File Size: " & $fileSize) LogProgram("Registry Size: " & RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Size")) ;Save information to registry for faster access. Compare size of picture to verify changes to picture LogProgram("File Sizes Do Not Match") RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Size", "REG_SZ", $fileSize) ;~ $prop = _GetFileProperty($path, "Dimensions") ;~ $dArray = StringSplit($prop, " x ") ;~ $pmpWidth = Number(StringMid($dArray[1], 2)) ;~ $pmpHeight = Number($dArray[4]) RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Width", "REG_SZ", $pmpWidth) RegWrite("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Height", "REG_SZ", $pmpHeight) LogProgram("File Sizes Match") $pmpWidth = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Width") $pmpHeight = RegRead("HKEY_CURRENT_USER\Software\Fullscreen Slideshow\Pictures", $pmPicName & " Height") LogProgram("pmpWidth: " & $pmpWidth) LogProgram("pmpHeight: " & $pmpHeight) EndFunc ;==>GetDimensions LogProgram("=CheckForImageChanges=") LogProgram("Old Count: " & $imageCount) LogProgram("New Count: " & $newCount[0]) LogProgram("New Images Found") $imageCount = $imageList[0] LogProgram("No New Images") EndFunc ;==>CheckForImageChanges LogProgram("=CreateGUI=") ;Hidden GUI for fixing if FSS becomes the active window LogProgram("FSS created") ;Parent, for window border hide effect LogProgram("hide created") ;Actual GUI to be used ;Slideshow GUI LogProgram("Fullscreen Slideshow created") LogProgram("smGUIhandle: " & $smGUIhandle) LogProgram("Show smGUI") ;Screensaver GUI Global $pmGUI = GUICreate("Fullscreen Screensaver", @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST), -1, $GUIHide) ;GUI is the size of the primary screen LogProgram("Fullscreen Screensaver created") LogProgram("pmGUIhandle: " & $pmGUIhandle) LogProgram("Hide pmGUI") EndFunc ;==>CreateGUI LogProgram("=MoveGUIWindow=") LogProgram("SM Position: " & $smPosition) ;Move GUI according to location of secondary monitor ;$position = WinGetPos("Fullscreen Slideshow") ;If $position[0] <> (-1 * $smWidth) Or $position[1] <> $smHeight Then ;EndIf Else ;Monitor on Right ;If $position[0] <> @DesktopWidth Or $position[1] <> $smHeight Then ;EndIf EndFunc ;==>MoveGUIWindow LogProgram("=ShowImageSM=") LogProgram("smImageChangeBlack: " & $smImageChangeBlack) Local $smhGraphics = _GDIPlus_GraphicsCreateFromHWND($smGUI) ;create a graphics object from a window handle LogProgram("smhGraphics: " & $smhGraphics) LogProgram("smPic: " & $smPic) LogProgram("smCenterX: " & $smCenterX) LogProgram("smCenterY: " & $smCenterY) EndFunc ;==>ShowImageSM LogProgram("=ShowImagePM=") Local $pmhGraphics = _GDIPlus_GraphicsCreateFromHWND($pmGUI) ;create a graphics object from a window handle LogProgram("pmhGraphics: " & $pmhGraphics) LogProgram("pmPic: " & $pmPic) LogProgram("pmCenterX: " & $pmCenterX) LogProgram("pmCenterY: " & $pmCenterY) EndFunc ;==>ShowImagePM LogProgram("=ShowTrayIcon=") LogProgram("No") LogProgram("Yes") EndFunc ;==>ShowTrayIcon LogProgram("=StartWithWindows=") LogProgram("Yes") RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow", "REG_SZ", '"' & @ScriptFullPath & '"') LogProgram("No") RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "Fullscreen Slideshow") EndFunc ;==>StartWithWindows LogProgram("=AlwaysOnTop=") ;Always keep FSS on top of other windows EndFunc ;==>AlwaysOnTop LogProgram("=LoseFocus=") ;If Fullscreen Slideshow becomes the active window, change to FSS EndFunc ;==>LoseFocus LogProgram("=CheckIfFSSshouldDisplay=") Local $returnValue ;Is selected window the Desktop? LogProgram("Window Size: " & $winSize) $desktop = 0 $desktop = 1 $desktop = 0 LogProgram("Desktop Selected?: " & $desktop) ;Where is the active window LogProgram("Active Window Position: " & $activeWindowPosition[0]) $decided = 1 $returnValue = "Hide" LogProgram("Active Window: On Left") LogProgram("Return: " & $returnValue) $returnValue = "Show" LogProgram("Active Window: On Right") LogProgram("Return: " & $returnValue) Else ;$smPosition = "Right" $decided = 1 $returnValue = "Hide" LogProgram("Active Window: On Right") LogProgram("Return: " & $returnValue) $returnValue = "Show" LogProgram("Active Window: On Left") LogProgram("Return: " & $returnValue) ;Only check if undecided ;Where is the mouse located $decided = 1 $returnValue = "Hide" LogProgram("Mouse Position: On Left") LogProgram("Return: " & $returnValue) Else ;$smPosition = "Right" ;Bottom right corner of SM is activation spot LogProgram("Mouse Activation Position") LogProgram("Return: " & $returnValue) $decided = 1 $returnValue = "Show" $decided = 1 $returnValue = "Hide" LogProgram("Mouse Position: On Right") LogProgram("Return: " & $returnValue) $decided = 1 $returnValue = "Hide" LogProgram("Mouse Position: On Right") LogProgram("Return: " & $returnValue) ;Is there a special Window that is active? ;Is VNC active? LogProgram("Cursor Hider Active") $decided = 1 ;Temporary while VNC is in main window ;$returnValue = "Hide" $returnValue = "Show" LogProgram("Return: " & $returnValue) ;Is the Toggle set to hide? ;Is Screensaver Off? LogProgram("forceFSSOn: " & $forceFSSOn) ;Get new image ready while hidden CleanupPrevImageSM() GetImageForDisplaySM() ShowImageSM() ;Hide GUI $decided = 1 $returnValue = "Hide" LogProgram("Return: " & $returnValue) $returnValue = "Show" ;Screensaver is active ;If no issues, then show $returnValue = "Show" LogProgram("Return: " & $returnValue) Return $returnValue EndFunc ;==>CheckIfFSSshouldDisplay LogProgram("=ShowFSS=") Else ;$smActivationMode = "Timer" (Screensaver mode) ;Redraw GDI LogProgram("=ShowFSS calling=") ShowImageSM() ShowImagePM() EndFunc ;==>ShowFSS LogProgram("=HideFSS=") $smRefreshImage = 1 EndFunc ;==>HideFSS LogProgram("=ChangeImageSM=") $smImageChangeBlack = 0 $smRefreshImage = 0 GetImageForDisplaySM() CleanupPrevImageSM() ShowImageSM() Else ;$smChangeMethod = "Timer" GetImageForDisplaySM() CleanupPrevImageSM() ShowImageSM() Else ;Use Black Image $smImageChangeBlack = 1 CleanupPrevImageSM() EndFunc ;==>ChangeImageSM LogProgram("=CleanupPrevImageSM=") ;_GDIPlus_GraphicsDispose($smGdiPic) ;_GDIPlus_BitmapDispose($smPic) EndFunc ;==>CleanupPrevImageSM LogProgram("=CleanupPrevImagePM=") ;_GDIPlus_GraphicsDispose($pmGdiPic) ;_GDIPlus_BitmapDispose($pmPic) EndFunc ;==>CleanupPrevImagePM LogProgram("=DisplayTaskbar=") ;Hide/Show Taskbar LogProgram("DisplayTaskbar calling") ShowTaskBar() EndFunc ;==>DisplayTaskbar LogProgram("=HideTaskBar=") EndFunc ;==>HideTaskBar LogProgram("=ShowTaskbar=") EndFunc ;==>ShowTaskBar LogProgram("=CloseProgram=") LogProgram("CloseProgram calling") CleanupPrevImageSM() LogProgram("CloseProgram calling") CleanupPrevImagePM() LogProgram("GDI Dispose") LogProgram("GDI Shutdown") LogProgram("GUI Delete") LogProgram("=End CloseProgram=") EndFunc ;==>CloseProgram LogProgram("=ScreensaverOperations=") LogProgram("Screensaver Activated? " & $screensaverActivated) LogProgram("Is Screensaver On? " & $screenSaverIsOn) ;Should Screensaver be activated? LogProgram("Idle Time Seconds: " & ($idleTime / 1000)) LogProgram("Activation Seconds: " & $pmSSActivationSec) LogProgram("=ScreensaverOperations calling=") CaptureScreen() ;Take a screenshot of entire screen (divided into sections) $checkCount = 1 $stop = 0 LogProgram("stop: " & $stop) LogProgram("=ScreensaverOperations calling=") $result = CompareScreen() ;Compare screenshots with current desktop LogProgram("result: " & $result) $checkCount += 1 $stop = 1 $stop = 1 ;Activate screensaver LogProgram("=ScreensaverOperations calling=") ShowScreensaver() Else ;If the screen has changed LogProgram("=ScreensaverOperations calling=") ShowScreensaver() Else ;The screen is changing, but the desktop is not active ;Reset Timer (to prevent constant checking) $screensaverActivated = 0 ;Erase screenshots LogProgram("=ScreensaverOperations calling=") ScreensaverCleanUp() EndIf ;If $screenSaverIsOn = 0 Else ;If $idleTime < $pmSSActivationSec LogProgram("=ScreensaverOperations calling=") HideScreensaver() ;=================== ;Change Image? $pmChangeImage = 1 LogProgram("=ScreensaverOperations calling=") GetImageForDisplayPM() CleanupPrevImagePM() ShowImagePM() ;=================== ;If $screensaverActivated = "No" do nothing EndFunc ;==>ScreensaverOperations LogProgram("=ShowScreensaver=") $screenSaverIsOn = 1 $forceFSSOn = 1 $blinkTaskbar = 1 EndFunc ;==>ShowScreensaver LogProgram("=HideScreensaver=") $screenSaverIsOn = 0 $forceFSSOn = 0 $blinkTaskbar = 0 EndFunc ;==>HideScreensaver LogProgram("=CaptureScreen=") $currentShot = 1 LogProgram("ssRows: " & $ssRows) LogProgram("ssColumns: " & $ssColumns) LogProgram("currentShot: " & $currentShot) ;Vertical LogProgram("currentYpos: " & $currentYpos) ;Horizontal LogProgram("currentXpos: " & $currentXpos) ($incrementX * $currentXpos), _ ($incrementY * $currentYpos), _ ($incrementX * ($currentXpos + 1)), _ $incrementY * ($currentYpos + 1), 0) LogProgram("screensaver " & $currentShot & ".bmp saved") LogProgram("screensaver " & $currentShot & ".bmp save error") $captureError = 1 $currentShot += 1 LogProgram("currentShot: " & $currentShot) Next ;x Next ;y ;If there is a capture error, retry once LogProgram("Attempt 2") $captureError = 0 $currentShot = 1 LogProgram("ssRows: " & $ssRows) LogProgram("ssColumns: " & $ssColumns) LogProgram("currentShot: " & $currentShot) ;Vertical LogProgram("currentYpos: " & $currentYpos) ;Horizontal LogProgram("currentXpos: " & $currentXpos) ($incrementX * $currentXpos), _ ($incrementY * $currentYpos), _ ($incrementX * ($currentXpos + 1)), _ $incrementY * ($currentYpos + 1), 0) LogProgram("screensaver " & $currentShot & ".bmp saved") LogProgram("screensaver " & $currentShot & ".bmp save error") $captureError = 1 $currentShot += 1 LogProgram("currentShot: " & $currentShot) Next ;x Next ;y EndFunc ;==>CaptureScreen LogProgram("=CompareScreen=") LogProgram("changeQuadrant: " & $resistance) $currentShot = 1 LogProgram("currentShot: " & $currentShot) LogProgram("currentYpos: " & $currentYpos) LogProgram("currentXpos: " & $currentXpos) If _ImageSearchArea(@WorkingDir & "\Screensaver\screensaver " & $currentShot & ".bmp", 1, ($incrementX * $currentXpos), ($incrementY * $currentYpos), ($incrementX * ($currentXpos + 1)), ($incrementY * ($currentYpos + 1)), $x, $y, 0) = 1 Then LogProgram("Image Did Not Change") LogProgram("Image Changed") $resistance -= 1 $currentShot += 1 LogProgram("currentShot: " & $currentShot) LogProgram("resistance: " & $resistance) LogProgram("Return: Changed") Return "Changed" LogProgram("Return: Changed") Return "Changed" LogProgram("Return: Not Changed") Return "Not Changed" $captureError = 0 LogProgram("Return: Skip") Return "Skip" EndFunc ;==>CompareScreen LogProgram("=CheckForDesktop=") $desktopFound = _ImageSearchArea("*Trans0xFF00FF" & @WorkingDir & "\Screensaver\Desktop.bmp", 1, 0, 0, @DesktopWidth, @DesktopHeight, $x, $y, 0) LogProgram("desktopFound: " & $desktopFound) Return $desktopFound EndFunc ;==>CheckForDesktop LogProgram("=ScreensaverCleanup=") Local $file LogProgram("screensaver " & $file & ".bmp delete error") LogProgram("screensaver " & $file & ".bmp deleted") EndFunc ;==>ScreensaverCleanUp EndFunc ;==>LogProgram