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 (Chrome)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rob

USA
2516 Posts

Posted - 12/27/2011 :  10:21:44  Show Profile  Visit Rob's Homepage  Reply with Quote
Here's a script that will open a link in a new tab in Chrome. It performs a right-click at the location the gesture started, then sends the down key (to select "Open in new tab" from the popup menu) and sends the Enter key. Finally, it moves the mouse back to the location where the gesture ended (puts the mouse back where it was) and sends CTRL+TAB to switch to the next tab (the newly opened tab, in theory). Could be some kinks with timing if your system is sluggish in displaying the popup menu inside Chrome, could add an acDelay(200) after acMouseClick(), play around with it and see.

acMouseClick(sp_gesture_start_x, sp_gesture_start_y, 0, 1, 1)
acSendKeys("{DOWN}~")
acMouseMove(sp_gesture_end_x, sp_gesture_end_y)
acSendKeys("^{TAB}")

Rob

USA
2516 Posts

Posted - 12/27/2011 :  15:32:58  Show Profile  Visit Rob's Homepage  Reply with Quote
Well, in my pursuit of doing things the right way...I've added some new actions in 1.0.9 to handle sending Ctrl, Alt, Shift, and Win down and up events independently..in this instance, it made more sense to be able to CTRL+Click instead of the hokey use of the context menu.

So this one does a control+click on the link, then pauses for 300ms and sends CTRL+TAB to switch to the new window (I have Chrome setup to open new tabs in the background).

acSendControlDown()
acMouseClick(sp_gesture_start_x, sp_gesture_start_y, 2, 1, 1)
acSendControlUp()
acMouseMove(sp_gesture_end_x, sp_gesture_end_y)
acDelay(300)
acSendKeys("^{TAB}")
Go to Top of Page

JohnR

USA
1 Posts

Posted - 02/23/2016 :  07:58:09  Show Profile  Reply with Quote
Ummm...I don't mean to sound like a party pooper, but your mouse already has this functionality: select the link using the middle (scroll wheel) click.

The shortcut to open a new tab is Ctrl+T.

Center clicking the link opens the tab to the background (as you stated is your default config) so...if you wanna open a link in a new tab and jump to it: make the gesture simulate the middle click followed by Ctrl+9

...or, you could just select the link and drag it to the tab bar for the same effect. (dragging the link out of the window will give you a new window, respectively).

Edited by - JohnR on 02/23/2016 08:03:09
Go to Top of Page

Rob

USA
2516 Posts

Posted - 02/23/2016 :  08:01:08  Show Profile  Visit Rob's Homepage  Reply with Quote
I'm aware of that. I honestly just don't prefer the movement from the mouse buttons where my fingers naturally rest. :)
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