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

Notification

Icon
Error

Options
Go to last post Go to first unread
skelddoo2  
#1 Posted : Monday, May 23, 2022 6:34:21 AM(UTC)
skelddoo2

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/1/2022(UTC)
Posts: 6

Thanks: 3 times
Hello,

I want to open a link in a new firefox tab in the background when clicked.
This can be done while holding shift and clicking middle mouse button on a link.
My problem is, the hotkey activates at the end of the drawn gesture point.
But I need to execute the hotkey where I began to draw the gesture.
How can I do that?

Steps I activated in my gesture:

1. Send Shift down

2. Mouse Click (options I activated there: point: Event Object, Current Value: StartPoint, button: direct input and middle click below, down: True, up: True

3. Send shift up

What more do I need? Please help.

Edited by user Monday, May 23, 2022 9:49:18 AM(UTC)  | Reason: Not specified

skelddoo2  
#2 Posted : Monday, May 23, 2022 10:55:18 AM(UTC)
skelddoo2

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/1/2022(UTC)
Posts: 6

Thanks: 3 times
I searched the forum again.
I added "sp.MouseMove(action.Start);" in the before-script section in the firefox app. Now it works for all firefox gestures.
But is it possible to add this line for a specific gesture only (e.g. open tab in background) as a step? I can not script at all so I search for a step to insert. But when I add this line to a macro and insert the macro as a step before my hotkeys, it does not work. "Action not defined".
skelddoo2  
#3 Posted : Monday, May 23, 2022 11:53:40 AM(UTC)
skelddoo2

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/1/2022(UTC)
Posts: 6

Thanks: 3 times
Ok. I pasted this line before a script. But now I need to add a mouse click without coordinates:
"sp.MouseClick(new Point(1108, 689), MouseButtons.Middle, true, false);" When I delete "new point" and the coordinates it is not working. What I need to delete/add to register only the mouseclick without the coordinates? thanks.
Rob  
#4 Posted : Monday, May 23, 2022 12:14:55 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
For your Firefox gesture, you can insert the Mouse Move step at the top of your Steps, selecting Event Object > StartPoint for the point parameter.

MouseClick (well, actually Windows itself) requires coordinates, however, if you simply want it to happen where the mouse is currently located, you can just pass that in:
Code:
sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Middle, true, false);

Note the above from your example isn't sending the Up button event - the last false means don't send the release, so the middle button will be held down.
Change to true if your intent is to send a full click
thanks 1 user thanked Rob for this useful post.
skelddoo2 on 5/23/2022(UTC)
Rob  
#5 Posted : Monday, May 23, 2022 12:16:39 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Also for Steps, you can call the Mouse > Get Current Mouse Point before Mouse Move and select From Stack for the point parameter.
thanks 1 user thanked Rob for this useful post.
skelddoo2 on 5/23/2022(UTC)
skelddoo2  
#6 Posted : Monday, May 23, 2022 12:40:20 PM(UTC)
skelddoo2

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/1/2022(UTC)
Posts: 6

Thanks: 3 times
Thanks Rob.
I added your line to the script.

Quote:
sp.MouseMove(action.Start);
sp.SendVKeyDown(vk.LSHIFT);
sp.Sleep(20);
sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Middle, true, false);
sp.Sleep(20);
sp.MouseClick(sp.GetCurrentMousePoint(), MouseButtons.Middle, false, true);
sp.Sleep(20);
sp.SendVKeyUp(vk.LSHIFT);
sp.Sleep(20);


Now it works Love
Lshift and Mouse3 needed some delay to recorgnize more often.
Rob  
#7 Posted : Monday, May 23, 2022 12:47:23 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 post(s)
Ah yes, sometimes you need to let the app process that the mouse is moving into position and actually clicking at a more realistic speed that a human would do.
skelddoo2  
#8 Posted : Monday, May 23, 2022 2:37:36 PM(UTC)
skelddoo2

Rank: Newbie

Reputation:

Groups: Approved
Joined: 1/1/2022(UTC)
Posts: 6

Thanks: 3 times
After some testing I changed the code a bit:
I typed "sp.mouseClick" in the scripting box and a helping popup informed me:
sp.MouseClick: "Can be an existing point like "action.start" or or a custom one using "new.point x,y.." "
So I tried it with withe the sp.mouseClick(action.start,...) parameters and the opening sucessrate for a new tab in the background increased even more:

Code:
sp.MouseMove(action.Start);
sp.SendVKeyDown(vk.LSHIFT);
sp.Sleep(20);
sp.MouseClick(action.Start, MouseButtons.Middle, true, false);
sp.Sleep(20);
sp.MouseClick(action.Start, MouseButtons.Middle, false, true);
sp.Sleep(20);
sp.SendVKeyUp(vk.LSHIFT);
sp.Sleep(20);
randomConstant  
#9 Posted : Monday, May 23, 2022 5:16:08 PM(UTC)
randomConstant

Rank: Advanced Member

Reputation:

Groups: Translators, Approved
Joined: 7/17/2021(UTC)
Posts: 135

Thanks: 35 times
Was thanked: 18 time(s) in 15 post(s)
Nice.

Since you are specifying where to click by using action.Start in the sp.MouseClick code, you don't need to move the mouse to action.Start beforehand since sp.MouseClick will click on the specified location after moving the mouse to that location, so sp.MouseMove(action.Start); can be safely removed.

Also, the last two boolean values (true false) at the end of sp.MouseClick indicate the click down and up events, so both can be set to true to fully click the button, instead of having click down and click up events consecutively as two separate statements.

The following script should do the same thing with slight time improvement:
Code:
sp.SendVKeyDown(vk.LSHIFT);
sp.Sleep(20);
sp.MouseClick(action.Start, MouseButtons.Middle, true, true);
sp.Sleep(20);
sp.SendVKeyUp(vk.LSHIFT);


Lastly, depending on the gesture, it might feel weird to have the mouse pointer magically teleport to another location, and thus having to move the mouse physically to reach the previous natural position. So, if the gesture requires considerable movement of the physical mouse on the mousepad, it might be helpful to have the mouse moved to the gesture end position right as the tab opens. Which can be done by including this line at the end of script:
Code:
sp.MouseMove(action.End);

Note that there is no sp.Sleep(20); mentioned before moving the mouse because it is not to be sensed by browser for tab opening and we want mouse pointer to reach its intended place as fast as possible to have a smoother experience. Also the other sleep statements can also be fine tuned so they take least time and still perform correctly for even smoother experience.

Hopefully this helps.
thanks 1 user thanked randomConstant for this useful post.
skelddoo2 on 5/24/2022(UTC)
Users browsing this topic
Guest
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.