StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Theinvoker  
#1 Posted : Tuesday, March 24, 2020 9:10:03 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 13
Italy
Location: Milano

Thanks: 2 times
Hello

i recently got a second monitor and i see i can use a command to move a window from a monitor to the other

acSendWindowToPreviousMonitor

This works but i have a problem

If i minimize every window that i just moved, then when i call it back from taskbar, that window maximimes on the wrong monitor, the one i moved that window.
Rob  
#2 Posted : Tuesday, March 24, 2020 9:39:09 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
acSendWindowToPreviousMonitor is a function in the original StrokesPlus.

If this post relates to that version, post on the StrokesPlus.com Forum instead.
Theinvoker  
#3 Posted : Tuesday, March 24, 2020 11:40:29 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 13
Italy
Location: Milano

Thanks: 2 times
ok sorry i didn't know there are 2 different Strokesplus

and with this one is it not possible to send windows to one monitor to another one?

Edit:
ok i'm tryng. it's working but i get bad animations
When moving windows to one monitor to the other, the window resizes and then maximizes fullscreen again. i don't like it. can i just move windows without all of this "resizing"?

Edited by user Tuesday, March 24, 2020 12:02:24 PM(UTC)  | Reason: Not specified

Rob  
#4 Posted : Tuesday, March 24, 2020 1:23:17 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
Quote:
When moving windows to one monitor to the other, the window resizes and then maximizes fullscreen again. i don't like it. can i just move windows without all of this "resizing"?


That's why you would get the issue of minimizing and clicking having it go back to the other screen.

When a window is maximized, Windows remembers its maximized position - this is why you had the issue in S+.

Restoring then moving and re-maximizing updates the window's location properly so you don't have the odd behavior you were originally mentioning :)

You can move it without the restore/maximize events using the script below, but note that you'll have your original issue.
Code:
//Move to Next screen - no restore/maximize
var screens = Screen.AllScreens;
var currentScreen = action.Window.Screen;
var targetScreen = currentScreen;
for (var i = 0; i < screens.Length; i++)
{
    if(screens[i].DeviceName == currentScreen.DeviceName)
    {
        if (i < (screens.Length - 1))
        {
            targetScreen = screens[i + 1];
        }
        else
        {
            targetScreen = screens[0];
        }
        break;
    }
}

action.Window.Location = new Point(targetScreen.WorkingArea.Left + (action.Window.RECT.Left - currentScreen.WorkingArea.Left), targetScreen.WorkingArea.Top + (action.Window.RECT.Top - currentScreen.WorkingArea.Top));
Theinvoker  
#5 Posted : Tuesday, March 24, 2020 1:32:33 PM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 13
Italy
Location: Milano

Thanks: 2 times
in this Strokesplus i like that is much easier to customize commands with hotkeys so i just used the WIN+SHIFT+ARROW combination and now it's all ok
Theinvoker  
#6 Posted : Sunday, April 5, 2020 4:52:25 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 13
Italy
Location: Milano

Thanks: 2 times
i need help with a specific app: KMplayer

This player can't be moved when it's in fullscreen mode. I know it's not strokesplus fault but maybe you know when strokesplus can't move a window because of some strange setting on that window that strokesplus (or better: the command to move windows)

i tried both with the default command and also with the code you gave me


Code:
//Move to Next screen - no restore/maximize
var screens = Screen.AllScreens;
var currentScreen = action.Window.Screen;
var targetScreen = currentScreen;
for (var i = 0; i < screens.Length; i++)
{
    if(screens[i].DeviceName == currentScreen.DeviceName)
    {
        if (i < (screens.Length - 1))
        {
            targetScreen = screens[i + 1];
        }
        else
        {
            targetScreen = screens[0];
        }
        break;
    }
}

action.Window.Location = new Point(targetScreen.WorkingArea.Left + (action.Window.RECT.Left - currentScreen.WorkingArea.Left), targetScreen.WorkingArea.Top + (action.Window.RECT.Top - currentScreen.WorkingArea.Top));



Also with Windows Media Player there are issues.
At fullscreen i can send video to the other monitor but it will stop for some seconds, and on the previous monitor i still see the player but black. It seems i just moved the video itself but not the app

Edited by user Sunday, April 5, 2020 8:30:23 AM(UTC)  | Reason: Not specified

Rob  
#7 Posted : Sunday, April 5, 2020 9:32:15 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 602
United States

Thanks: 5 times
Was thanked: 134 time(s) in 120 post(s)
So KMPlayer appears to be a Delphi application - those apps use a very non-standard window hierarchy, which I've written about before on StrokesPlus and StrokesPlus.net forums.
There are some consistencies between them, like having a main TApplication class window, but the way each developer implements them can be specific. Examining the windows and messages being passed around, it uses a lot of custom messages to communicate between the various windows (there are several "windows" used by the application). So while it is possible to handle this in S+ scripts, you would have to do a deep dive and map out those message and custom send them to the right windows, in the right sequence, and based on the state of those windows. Unfortunately, that is a very time consuming process and is not something I can just send you.

Windows Media Player also has some different window states/hierarchy when in full screen, though nowhere near as complicated as KMPlayer.

For both of these, the best approach would be to simulate the events which bring them out of full screen, then move them, and simulate the events to enable full screen again (e.g. sending key strokes if available).
You would probably also want to check to see if the window is full screen to determine if you need to perform those extra steps or not.

The example below handles Windows Media Player (I didn't do anything for KMPlayer) or any other window. You might need to change calls to MoveToNextScreen if you want to use the Windows shortcut keys instead of the S+ code.

Code:
//If Windows Media Player, use custom logic
if(action.Window.Process.MainModule.ModuleName == "wmplayer.exe")
{
    var fgWindow = action.Window;
    var screen = fgWindow.Screen; 
    var wasFullScreen = false;

    fgWindow.Activate(); //Make sure the window is activated (see below)

    //Check to see if window is full screen
    if(screen.Bounds.Left == fgWindow.Rectangle.Left
            && screen.Bounds.Right == fgWindow.Rectangle.Right
            && screen.Bounds.Top == fgWindow.Rectangle.Top
            && screen.Bounds.Bottom == fgWindow.Rectangle.Bottom) 
    {
            //Full screen, send Alt+Enter to bring the player out of full screen mode
            wasFullScreen = true;
            sp.SendModifiedVKeys([vk.LMENU], [vk.RETURN]);
            sp.Sleep(100);
    } 

    //Use the active window, since when you leave full screen, 
    //action.Window will no longer match the player window
    sp.ForegroundWindow().MoveToNextScreen();

    if(wasFullScreen)
    {
        //Set back to full screen
        sp.SendModifiedVKeys([vk.LMENU], [vk.RETURN]);
    }
}
else
{
    //Not wmplayer.exe, do the normal stuff
    action.Window.MoveToNextScreen();
}
Theinvoker  
#8 Posted : Sunday, April 5, 2020 10:48:34 AM(UTC)
Theinvoker

Rank: Member

Reputation:

Groups: Approved
Joined: 3/24/2020(UTC)
Posts: 13
Italy
Location: Milano

Thanks: 2 times
Thanks but windowsmediaplayer was just a try. i don't use it

My main players are Pot and KM for 2 different things. SMplayer is the alternative.
KMplayer (3) is the only one with a decent library, that's why i'm still using that old player even now.

WMP has library but no mouse controls, no drag window from any point of the player, no hotkeys (plugin for this but not for all commands i need).
same for winamp. Good library but no controls
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.