StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 Open link in new tab
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mesersmith

Romania
41 Posts

Posted - 10/24/2013 :  13:38:21  Show Profile  Reply with Quote
This is teh defaul code for this action, but it doesn't work.
I need when I right click on a link and drag down, I need to open a new tab with this link content.
Can I make some modification to make it work?
I use Chrome.

if acGetMouseCursorType() == "HAND" then
acMouseClick(gsx, gsy, 1, 1, 1)
else
acSendKeys("^t")
end

Thanks.

Rob

USA
2516 Posts

Posted - 10/24/2013 :  13:44:49  Show Profile  Visit Rob's Homepage  Reply with Quote
The original code was meant to either open the link in a new window if the cursor is a HAND, or open a new tab if not. That code checks to see if the mouse cursor is a HAND pointer at the time the action is triggered. If you've dragged the mouse down and away from the link, it will no longer have a HAND pointer cursor. You can simply call:

acMouseClick(gsx, gsy, 1, 1, 1)
Go to Top of Page

mesersmith

Romania
41 Posts

Posted - 10/24/2013 :  13:54:31  Show Profile  Reply with Quote
Yes, I understand the meaning of the code, and it works if I drag the mouse a little, to be stil a hand.
Than, I use your code and works great. But how can I write a code wich will do the same thing, but it must open that new tab.
Now it works, but the new tab is in backgroud. I have to click on it to open it.
It can be done?
Go to Top of Page

Rob

USA
2516 Posts

Posted - 10/24/2013 :  14:12:33  Show Profile  Visit Rob's Homepage  Reply with Quote
To replicate that functionality using a gesture which draws away from the link, you'd have to do something like this:
acConsumePhysicalInput(1) --prevent hand mouse movements from moving the mouse
acMouseMove(gsx, gsy) --move the cursor back to where the gesture began
acDelay(50) --pause briefly to allow the cursor to be drawn
if acGetMouseCursorType() == "HAND" then
	acMouseClick(gsx, gsy, 1, 1, 1) 
else
	acSendKeys("^t")
end
acMouseMove(gex, gey)  --move the mouse back to where the gesture ended
acConsumePhysicalInput(0) --allow input to behave as normal

Chrome doesn't open tabs in the foreground by default, so you'd have to use an extension such as:

Tab Activate
Go to Top of Page

mesersmith

Romania
41 Posts

Posted - 10/24/2013 :  14:18:40  Show Profile  Reply with Quote
Wow, works great, almost similar to mouse gesture in Opera.
Go to Top of Page

mesersmith

Romania
41 Posts

Posted - 03/26/2015 :  14:21:10  Show Profile  Reply with Quote
I have this code:

-- this code does one of two things, if the mouse cursor
-- is a HAND, the link below the cursor is opened in a new
-- tab. If the mouse cursor is not a HAND, a new browser
-- tab is opened this action is executed by holding the
-- stroke button and clicking the left mouse button, either
-- over a link or anywhere over the browser for a new tab
--if acGetMouseCursorType() == "HAND" then
-- acMouseClick(gsx, gsy, 1, 1, 1)
--else
-- acSendKeys("^t")
--end


acConsumePhysicalInput(1) --prevent hand mouse movements from moving the mouse
acMouseMove(gsx, gsy) --move the cursor back to where the gesture began
acDelay(50) --pause briefly to allow the cursor to be drawn
if acGetMouseCursorType() == "HAND" then
acMouseClick(gsx, gsy, 1, 1, 1)
else
acSendKeys("^t")
end
acMouseMove(gex, gey) --move the mouse back to where the gesture ended
acConsumePhysicalInput(0) --allow input to behave as normal


This code works like a charm in Internet Explore, Chrome and Modzilla, but doesn't work at all in Opera 28. Is there anybody who knows why is that?

I have several codes like this, with another function, wich doesn't work on Opera, but works great in any other browser.

Edited by - mesersmith on 03/26/2015 14:29:37
Go to Top of Page

SonGokussj4

9 Posts

Posted - 04/29/2015 :  03:08:08  Show Profile  Reply with Quote
Hello, I've got a problem. I'm using Firefox with Strokes+
In the past I've been using Firefox plugin - Fire Gestures and there were two strokes I really loved.
Up (on link) - open in a new tab on top
Down (on link) - open in a new tab on background
(Up or Down (when multiple links were selected (even with some text)) - open all links on top/background)

But I really LOVE strokes+ so I tried to recreate this condition + classic Copy / Paste. But it's not functioning 100%.

"My" code: (As shown in previous post and slightly modified)
[ Stroke - Down ]

acConsumePhysicalInput(1) --prevent hand mouse movements from moving the mouse
acMouseMove(gsx, gsy) --move the cursor back to where the gesture began
acDelay(20) --pause briefly to allow the cursor to be drawn
if acGetMouseCursorType() == "HAND" then
acMouseClick(gsx, gsy, 1, 1, 1)
else
acSendKeys("^v")
end
acMouseMove(gex, gey) --move the mouse back to where the gesture ended
acConsumePhysicalInput(0) --allow input to behave as normal


The problem is that when I start the gesture on Link, and end upon another link, it does nothing.
Now and then it does nothing even when the stroke is good. I have to do it for the second time and then it works.
And I'm not even speaking about the nervecracking functionality when on Youtube and the video is on focus. (did someone resolve that somehow? "when youtube site / unfocus / do the gesture...)

I'm writing mainly if anyone has some kind of "better code" then this one for this operation of opening links.

Thank you very much and Rob - I LOVE your work and I'm recommending it from person to person. :-) And they love it too.
Go to Top of Page

Rob

USA
2516 Posts

Posted - 04/30/2015 :  20:58:20  Show Profile  Visit Rob's Homepage  Reply with Quote
Hmm, I can't reproduce this on my system. Is there a possibility that S+ isn't recognizing the gesture? Or recognizing a different gesture which doesn't result in any visible action?

If you can give me a very specific web page and set of links for me to try to reproduce, I'll see if I can find anything. I went to Google and started a search, then used your exact script without error.

However, note that the "HAND" check is over the exact pixel where the gesture started..if you happen to be just outside the hyperlink border that Firefox assigns for the link, when S+ moves the mouse there, it won't be a hand cursor, thus will send CTRL+V resulting in nothing happening.
Go to Top of Page

Strokeman

33 Posts

Posted - 05/05/2015 :  12:10:28  Show Profile  Reply with Quote
quote:
Originally posted by SonGokussj4
And I'm not even speaking about the nervecracking functionality when on Youtube and the video is on focus. (did someone resolve that somehow? "when youtube site / unfocus / do the gesture...)


Try this thread .. has 2 solutions ( 2nd one seems easy, yet to check myself)
http://www.strokesplus.com/forum/topic/332/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000