AutoHotkey Community

It is currently May 27th, 2012, 2:56 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: November 22nd, 2009, 9:36 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
hello

this script enables in opera browser, to open links in new background tabs with right click

however it happens to open both the link in the current tab and in a new background tab (as if I clicked with left click as well)

can anybody fix it please?
thanks

Code:
; General
#SingleInstance Force
#Persistent

#IfWinActive ahk_class OpWindow
deactivate:=false
RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
  {
    If !deactivate
    {
      MouseClick, middle
      Send {ENTER}
    }
  }
  Else
    MouseClick, right
  return
^RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
  {
    deactivate:=true
    MouseClick, right
    deactivate:=false
  }
  Else
    Send ^{Click right}
  return
#IfWinActive

#NoTrayIcon


Last edited by azure on November 22nd, 2009, 10:45 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2009, 10:43 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Am i right to assume that "deactivate" is to stop MouseClick from recursively calling RButton:: ?

If so, then try the following ...
Code:
; General
#SingleInstance Force
#Persistent
#NoTrayIcon

#IfWinActive ahk_class OpWindow
$RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
  {
    MouseClick, middle
    Send {ENTER}
  }
  Else
    MouseClick, right
  return
$^RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
    MouseClick, right
  Else
    Send ^{Click right}
  return
#IfWinActive


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 23rd, 2009, 2:56 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
a_h_k wrote:
Am i right to assume that "deactivate" is to stop MouseClick from recursively calling RButton:: ?

If so, then try the following ...
Code:
; General
#SingleInstance Force
#Persistent
#NoTrayIcon

#IfWinActive ahk_class OpWindow
$RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
  {
    MouseClick, middle
    Send {ENTER}
  }
  Else
    MouseClick, right
  return
$^RButton::
  WinGet, operaWindow, ID, ahk_class OpWindow
  MouseGetPos, x, y, selectedWindow
  If (operaWindow==selectedWindow)
    MouseClick, right
  Else
    Send ^{Click right}
  return
#IfWinActive


not sure about the 'deactivate' I suppose it does so

however your script doesn't work either

I have noticed that if I right click on a link while having ESC key pushed, it opens the link in a new background tab, without opening in the current tab as well (as if I left clicked the link)

however I don't want ESC to be pressed, since it stops webpage loading

also, when I leave the finger on the touchpad and then I right click, it opens the link only in a new background tab, can anyone simulate this into a AHK script?

any ideas??? about ESC or maybe a better one?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 2:31 pm 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Did a google on opening tab in background, & found that Ctrl-Shift-Left_click will open a new tab in the background

So with that new info, starting from scratch...
Code:
#IfWinActive ahk_class OpWindow
$RButton::
  If A_Cursor = Unknown        ;unknown = hand cursor
    Send ^+{LButton}
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 25th, 2009, 9:37 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
a_h_k wrote:
Did a google on opening tab in background, & found that Ctrl-Shift-Left_click will open a new tab in the background

So with that new info, starting from scratch...
Code:
#IfWinActive ahk_class OpWindow
$RButton::
  If A_Cursor = Unknown        ;unknown = hand cursor
    Send ^+{LButton}
Return


it seems to work well, but the problem is that sometimes the cursor it is over a link and it is not in hand-shape, but in arrow-shape or sunglass-shape...
is there any solution for this?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 26th, 2009, 5:22 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Yep .. it's in here :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 8:10 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
the original script I posted has solved this problem, is there a way to integrate your script to the original?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2009, 9:39 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
Have tested it out (on Firefox), & fixed the bugs...
Code:
#NoTrayIcon
#IfWinActive ahk_class OpWindow
$RButton::
  If (A_Cursor="Unknown")   ;Ensures this operates only over links (Unknown = hand)
    Send ^+{LButton}
  Else
     Send {RButton}   ;Brings-up right-mouse menu (as normal)
Return

In Firefox there seems to be only 1 possible mouse pointer for when mouse is over a link: Hand (Unknown)


Last edited by a_h_k on November 30th, 2009, 7:45 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2009, 7:15 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
mm not, now it doesn't work at all, right click on links does nothing


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], rbrtryn and 27 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group