StrokesPlus.net教程及脚本(官网和论坛已关闭)

谢谢大佬,这个好像只有提示有这个效果,手势好像没有

edge在使用垂直标签的时候好像就不生效了,我不知道该修改哪里的代码,大佬有空可以看一下

我没有鼠标没办法测试中键,你试下鼠标正常能不能中键关闭垂直标签页

中键可以

试着改下这个距离,左侧屏幕到浏览器标签的垂直距离

mouseHookEvent.Location.X >= mouseWindow.Rectangle.Left && mouseHookEvent.Location.X < mouseWindow.Rectangle.Left + 35

这两段都要改吗,能否同时保留两个位置的右键关闭效果

都保留也行,等切换横排显示也能右键关

我该如何添加代码呢 这两段复制进去吗

加2个竖线,粘贴到后面

我试了一下好像不行,我不知道这个代码放在哪里,可以麻烦你把完整的代码发一下吗,就是包含正常标签右键关闭的这个代码,再加上垂直标签的

这个我用不了,然后我用GPT代码,右键关闭时而有效,时而弹出右键菜单,麻烦大佬看一下

// 浏览器进程名称列表
var browser_name = ["chrome.exe", "MicrosoftEdge.exe", "msedge.exe", "Firefox.exe"];

// 垂直标签栏的宽度(根据实际情况调整)
var tabBarWidth = 50;

// 存储鼠标右键按下时的Y坐标
var start_Y = 0;

// 鼠标按钮事件绑定对象
var mouseButtonEventObj = sp.GetStoredObject("mouseButtonEvent");

// 如果已存在绑定,则断开并删除
if (mouseButtonEventObj && mouseButtonEventObj.GetType().FullName.includes('EventConnection')) {
    mouseButtonEventObj.disconnect();
    sp.DeleteStoredObject("mouseButtonEvent");
}

// 创建鼠标按钮事件绑定
var mouseButtonEvent = MouseHook.OnMouseHookButtonEvent.connect(
    function (sender, mouseHookEvent) {
        try {
            if (mouseHookEvent.Button == MouseButtons.Right) {
                if (mouseHookEvent.ButtonState == ButtonState.Down) {
                    start_Y = mouseHookEvent.Location.Y;
                }

                var mouseWindow = sp.WindowFromPoint(mouseHookEvent.Location, true);
                if (mouseWindow && browser_name.includes(mouseWindow.Process.MainModule.ModuleName)) {
                    var windowRect = mouseWindow.Rectangle;

                    // 检测点击是否在垂直标签栏上
                    var isVerticalTabBarClick = mouseHookEvent.Location.X <= windowRect.Left + tabBarWidth &&
                                                mouseHookEvent.Location.X >= windowRect.Left;

                    // 检测点击是否在顶部标签栏上
                    var isTopTabBarClick = mouseHookEvent.Location.Y >= windowRect.Top &&
                                           mouseHookEvent.Location.Y < windowRect.Top + 45;

                    // 只在垂直标签栏或顶部标签栏上触发操作
                    if ((isVerticalTabBarClick || isTopTabBarClick) &&
                        start_Y >= windowRect.Top &&
                        start_Y < windowRect.Top + 45 &&
                        !mouseHookEvent.InjectedByHost) {
                        if (mouseHookEvent.ButtonState == ButtonState.Up) {
                            var controlKeyPressed = (sp.GetKeyState(vk.CONTROL) & 0x8000) !== 0;
                            if (controlKeyPressed) {
                                // Ctrl + 右键点击
                                sp.CreateTimer("rightClick", 0, -1,
                                    `sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Right, true, true); sp.DeleteTimer("rightClick");`);
                            } else {
                                // 中键点击
                                sp.CreateTimer("middleClick", 0, -1,
                                    `sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Middle, true, true); sp.DeleteTimer("middleClick");`);
                            }
                        }
                        mouseHookEvent.Consume = true;
                    }
                }
            }
        } catch (err) {
            StrokesPlus.Console.Log(err.message);
        }
    }
);

// 存储鼠标按钮事件绑定对象
sp.StoreObject("mouseButtonEvent", mouseButtonEvent);

试下,我没办法测试

// Define globally instead of each click
var browser_classname = ["Chrome_WidgetWin_1", "MozillaWindowClass"];

var mouseButtonEventObj = sp.GetStoredObject("mouseButtonEvent");
//Disconnect any existing binding for this object name
if(mouseButtonEventObj.GetType().FullName.includes('EventConnection'))
{
    mouseButtonEventObj.disconnect();
    sp.DeleteStoredObject("mouseButtonEvent");
} 

//Create the event binding and bind to synchronous event
var mouseButtonEvent = MouseHook.OnMouseHookButtonEvent.connect(
    function (sender, mouseHookEvent) {
        //Wrap all code in try/catch, exceptions will crash S+
        try
        {
            if(mouseHookEvent.Button == MouseButtons.Right)
            {
                var mouseWindow = sp.WindowFromPoint(mouseHookEvent.Location, true);
                if(browser_classname.includes(mouseWindow.ClassName) 
                    && ((mouseHookEvent.Location.Y >= mouseWindow.Rectangle.Top && mouseHookEvent.Location.Y < mouseWindow.Rectangle.Top + 35) || (mouseHookEvent.Location.Y >= mouseWindow.Rectangle.Top + 70 && mouseHookEvent.Location.Y < mouseWindow.Rectangle.Top + 105) || (mouseHookEvent.Location.X >= mouseWindow.Rectangle.Left && mouseHookEvent.Location.X < mouseWindow.Rectangle.Left + 35))
                    && !mouseHookEvent.InjectedByHost) 
                {
                    if(mouseHookEvent.ButtonState == ButtonState.Up)
                    {
                        if (sp.GetKeyState(vk.CONTROL) & 0x8000)
                        {
                            // Invoke right click on new thread so the hook
                            // doesn't get stuck while waiting for this method 
                            // to return
                            sp.CreateTimer("rightClick", 
                                           0, 
                                           -1, 
                                           `sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Right, true, true); 
                                            sp.DeleteTimer("rightClick");`
                                          );
                            
                        }
                        else
                        {
                            // Invoke middle click on new thread so the hook
                            // doesn't get stuck while waiting for this method 
                            // to return
                            sp.CreateTimer("middleClick", 
                                           0, 
                                           -1, 
                                           `sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Middle, true, true); 
                                            sp.DeleteTimer("middleClick");`
                                          );
                        }
                    }
                    mouseHookEvent.Consume = true;
                }
            }
        }
        catch(err) 
        {
            StrokesPlus.Console.Log(err.message);
        }
    });

//Note that on S+ reload, events in Stored Object list have disconnect called on them
sp.StoreObject("mouseButtonEvent", mouseButtonEvent);

麻烦了,跟我上面的代码差不多的效果,就是右键点出来大部分时候是右键菜单,偶尔直接关闭了

怎么实现鼠标左键选中文字,然后右键点击一下复制,期间左键未松开,我在其他软件上实现了,但strokesplus运行时动作会被覆盖其他软件的动作就失效了

左键选,左键不放,按右键复制,是这样嘛

同时其他软件也设置了这个功能?

然后是要在其他软件生效,s+不会阻止嘛?

就是说S+覆盖了,或者有没有没设置的手势动作不触发吞掉的方法

为啥要同时设置相同功能,有特别的作用还是?就在一个里面设置,能生效不就好了

告诉你一个我在gesturesign触摸板手势软件使用相同功能的办法,就是把功能定义快捷键,任何软件调用快捷键,就能执行功能

定义快捷键不管用ahk也好,s+也好

麻烦大佬什么时候测试一下,这个大部分时候是失灵的

请问一下我想要鼠标手势激活一个程序窗口并且让窗口位置跟随到鼠标位置要怎样设置动作,感谢~