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

Notification

Icon
Error

Options
Go to last post Go to first unread
Yuichi  
#1 Posted : Saturday, September 22, 2018 8:03:03 AM(UTC)
Yuichi

Rank: Newbie

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 7
Poland

Hi
Can anyone tell me how to move and show specific "floaters" using commands?
I found the "CustomFloaterSetting" and "sp_config.CustomFloaters" commands, but I do not know how to use them.Confused

My idea is to use the floater on the button in the window and move it with the window.
The left mouse button will update the position on screen and show only the specified floater when i click on a specified window.

Yuichi  
#2 Posted : Sunday, October 7, 2018 9:54:49 AM(UTC)
Yuichi

Rank: Newbie

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 7
Poland

Thanks to one guy who showed me how to do it i made this.

The floater will not be turned off, but will be moved out of the screen when the window you want is not active or it was closed.
Place that script in Left Mouse Button.

Code:
sp.Sleep(30); // to 50
var floater_name = "New Floater";
var floater = sp.WindowFromClassOrTitle("", "StrokesPlus.net Touch Custom Floater - " + floater_name);
if (floater != null) {
    //var wnd = sp.WindowFromPoint(sp.GetCurrentMousePoint(), true);
    var wnd = sp.ForegroundWindow(); // sometimes this function works better than the one above
    var w_title = "Untitled - Notepad";
    var w_exe = "notepad";
    var f_pos = floater.Position;

    if (wnd.Title == w_title && wnd.Process.ProcessName == w_exe) { // stick to window
        var x = 10;
        var y = 10;
        f_pos.Left = wnd.Position.Left + x; // x
        f_pos.Top = wnd.Position.Top + y; // y
        f_pos.Right = f_pos.Left + floater.Rectangle.Width; // x
        f_pos.Bottom = f_pos.Top + floater.Rectangle.Height; // y
        floater.Position = f_pos;

    } else if (wnd.Process.ProcessName != "StrokesPlus.net") { // hide floater (do not work in S+Net / floater)
        var x = 1360;
        var y = 0;
        f_pos.Left = x; // x
        f_pos.Top = y; // y
        f_pos.Right = f_pos.Left + floater.Rectangle.Width; // x
        f_pos.Bottom = f_pos.Top + floater.Rectangle.Height; // y
        floater.Position = f_pos;
    }
}
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.