Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

User Image
Benjamin28
15 discussion posts
Hi,

Is it possible to somehow abort the screensaver programmatically? I need to take a screenshot of a computer's desktop before i remote into it with TeamViewer, but the screensaver is blocking the view.

I tried creating a trigger with a function that disables the screensaver, but nothing happens. I have also attached a simple Show Notification function to the trigger, which is fired just fine, so I'm sure the trigger is fired.

Furthermore I need to maximize a window when the screensaver is aborted - is this possible? And if so, how?
Feb 27, 2018  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You could probably use a Scripted Function in the Trigger that moves the mouse a little bit, to deactivate the screen saver. The same Scripted Function could also maximize the window as well. What's the window title of the window you want maximized? I can write up a sample to get you started.

Thanks!
Feb 27, 2018  • #2
User Image
Benjamin28
15 discussion posts
It seems moving the mouse did the trick indeed. I tried with both keypress and mouseclick with no luck. Thanks!

Is it furthermore possible to create a trigger for when screensaver exits? I wish to maximize a window when the screensaver is closed, if certain conditions are met.
Feb 28, 2018 (modified Feb 28, 2018)  • #3
Keith Lammers (BFS)'s profile on WallpaperFusion.com
You could try using a Process Ended Trigger event, and put the name of the screen saver file in it, like this:

*DFSSaver.scr

In theory that should fire when the DisplayFusion Screen Saver exits.

If you use just the Windows screen saver settings instead of DisplayFusion, you'd need the name of the screen saver itself (e.g. *Ribbons.scr)
Feb 28, 2018  • #4
User Image
Benjamin28
15 discussion posts
I use your website screen saver, how do I find the file name on that? And should i recognize it by process filename, or some other?

EDIT: I found the Website.scr in the DisplayFusion folder, but the trigger does not fire on process end, neither on full path or if i put a * in front.

EDIT2: The trigger fires if I manually run the Website.scr file, but not if I start it through DF.

EDIT3: I ended up writing a custom screensaver detecter script, looking for any application with *.scr, and if it finds any then wait for it to stop existing, and maximize the specific window. It's not pretty, but it works(ish).

EDIT4: I found the script being too slow, it could take 1 second or more before it maximized, I need it to maximize instantly (the user should not be able to see the desktop at any point).

EDIT5: I ended up with the script below, I think that was the only one I could make work consistently and satisfyingly. However it would really be nice if a screensaver exit could broadcast an event, which we could act upon.

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{

    static int mouseX=0;
    static int mouseY=0;
    static bool maximizeTriggerFired = true;
    public static void Run(IntPtr windowHandle)
    {
            IntPtr torWindow = BFS.Application.GetMainWindowByFile("*java.exe");
    
        while(true){
                if(torWindow == IntPtr.Zero){
                    torWindow =  BFS.Application.GetMainWindowByFile("*java.exe");
                }
             
                BFS.General.ThreadWait(50);
            
                if(torWindow == IntPtr.Zero){continue;} //If the window does not exist, do nothing
                if(BFS.Window.IsMaximized(torWindow)){continue;} //If the windows is already maximized, do nothing
                if(BFS.Application.GetMainWindowByFile("*TeamViewer.exe") != IntPtr.Zero){continue;} //If teamviewer is running, do nothing
            
                //If mouse has been moved, maximize the window. The code cannot reach here if the window is already maximized, due to previous if-statement.
                if(BFS.Input.GetMousePositionX() != mouseX || BFS.Input.GetMousePositionY() != mouseY){
                    mouseX = BFS.Input.GetMousePositionX();
                    mouseY = BFS.Input.GetMousePositionY();
                    BFS.Window.Maximize(torWindow);
                }
        }
    }
}
Mar 1, 2018 (modified Mar 2, 2018)  • #5
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Thanks for the updates! Glad to hear you were able to get something working there. We will definitely let you know when we're able to add a screen saver starts/exits Trigger event.
Mar 5, 2018  • #6
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)