Mouse double click script

PHOTO EMBED

Mon Dec 05 2022 03:53:16 GMT+0000 (Coordinated Universal Time)

Saved by @savabeh191

//Only do this on mouse up (release)
if(!click.Down) {
    //Get the window below the mouse
    var mouseWindow = sp.WindowFromPoint(sp.GetCurrentMousePoint(), true);
    //Check if the window below the mouse cursor is Chrome and that the mouse is 
    //within 25px of the top of the window
    try {
        if(mouseWindow.Process.MainModule.ModuleName == "chrome.exe" 
                                                     && click.Point.Y >= mouseWindow.Rectangle.Top 
                                                     && click.Point.Y <= mouseWindow.Rectangle.Top + 25) {
            //If this is the second click, based on the previously stored value from the first click
            if(sp.GetStoredBool("ChromeClick")) {
                //Send CTRL+W to close the tab
                sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_W]);
            } else {
                //This is the first click, so store a value which can be used on next click
                sp.StoreBool("ChromeClick", true);
                //Create a timer that waits 200 milliseconds, then clears the click value and removes 
                //the timer (itself)
                //NOTE: You may increase the 200 value below if you want to allow more time 
                //between first and second click
                sp.CreateTimer("ChromeClickTimer", 200, 0, `sp.DeleteStoredBool("ChromeClick"); 
                                                            sp.DeleteTimer("ChromeClickTimer");`
                              );
            }
        }
    } catch {}
}
content_copyCOPY

https://forum.strokesplus.net/posts/t6044-Mouse-double-click-script