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

Notification

Icon
Error

Options
Go to last post Go to first unread
00001  
#1 Posted : Sunday, April 21, 2024 4:10:25 AM(UTC)
00001

Rank: Member

Reputation:

Groups: Approved
Joined: 3/31/2024(UTC)
Posts: 14

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I'm trying to make a key combination work when the window is not in focus. The application is Steam.
It doesn't work only in Steam; it works in other applications.
Code:

var curwin = sp.WindowFromPoint(action.Start, true); 
curwin.Activate(); 
sp.SendVKey(vk.HOME)

I tried using a left mouse click:
When the cursor is "Arrow", it works.
When the cursor is "HAND", it either does nothing or follows the link.
How can I prevent it from following the link?
Code:

var startPoint = action.Start;
var currentMouseCursor = sp.GetCurrentMouseCursor();

if (currentMouseCursor == "Arrow") {
    sp.MouseClick(startPoint, MouseButtons.Left, true, true);
    sp.Sleep(100);
    sp.SendVKey(vk.END);
} else if (currentMouseCursor == "Hand") {
    var curwin = sp.WindowFromPoint(action.Start, true);
curwin.Activate();
    sp.Sleep(100);
    sp.SendVKey(vk.END);
}

Edited by user Thursday, April 25, 2024 11:46:55 PM(UTC)  | Reason: What is this script for

00001  
#2 Posted : Wednesday, April 24, 2024 11:07:55 PM(UTC)
00001

Rank: Member

Reputation:

Groups: Approved
Joined: 3/31/2024(UTC)
Posts: 14

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
maybe someone could use this crutch.

Code:
var curwin = sp.WindowFromPoint(action.Start, true); // Get the window where the gesture started

// Get the executable name of the current window
var exeName = curwin.Process.MainModule.ModuleName.toLowerCase();

// Determine actions based on the window type (application)
if (exeName.includes("steamwebhelper.exe")) {
    // If the window is a Steam application (steamwebhelper.exe)
    action.Window.Activate(); 
    sp.ConsumePhysicalInput(true); // Disable physical input

    var oppened = false;
    var i = action.Start.Y;
    var i_end = i + 6;

    while (i < i_end) {
        sp.MouseMove(new Point(action.Start.X, i));
        sp.Sleep(10); 
        if (sp.GetCurrentMouseCursor() == "Hand") {
            oppened = true;
        }
        i = i + 2;
    }

    if (oppened) {
        var curwin = sp.WindowFromPoint(action.Start, true);
        curwin.Activate();
        sp.SendModifiedVKeys([vk.LCONTROL], [vk.END]); 
    } else {
        var currentMouseCursor = sp.GetCurrentMouseCursor();
        if (currentMouseCursor == "Arrow" || currentMouseCursor == "IBeam") {
            sp.MouseClick(action.Start, MouseButtons.Left, true, true);
            sp.SendModifiedVKeys([vk.LCONTROL], [vk.END]); 
        }
    }

    sp.ConsumePhysicalInput(false); // Enable physical input
} else {
    // If the window is not Steam, perform the default action (e.g., refresh the page)
    curwin.Activate(); 
    sp.SendModifiedVKeys([vk.LCONTROL], [vk.END]);
}
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.