topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 2:54 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Forward button on Mouse Explorer to Open Link in a New Window  (Read 13369 times)

wasker

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 52
    • View Profile
    • Donate to Member
I've got an MS MouseExplorer and came with the following code to make it open links in a new window when I browsing with IE:

XButton2::
If WinActive("ahk_class IEFrame")
{
    Send, {SHIFT down}{LButton}{SHIFT up}
    return
}
else
{
    Send, {XButton2}
    return
}

Now I would like to make it work with all apps that use IE for browsing purposes (Html Help for instance). I need to detect the class of window that is currently under mouse cursor. How to do this?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #1 on: December 14, 2005, 08:44 AM »
great question.

there are programs that will tell you the windows classes of other windows; often they have "spy" in their names, like windows "spy" or something.  i can't remember any off hand but if you can't find a good free one with google and no one else posts the link for one i'll look again.

wasker

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 52
    • View Profile
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #2 on: December 14, 2005, 08:56 AM »
Actually I know window class name I need. And in fact AutoHotkey has the Spy in its distro for this purpose. What I don't know is which function of AutoHotkey determines the class of window under cursor. I mean not the window like IE window itself, but rather control's window (InternetExplorer_Server for instance).

In other word: I want Autohotkey to run the aforementioned macro if the mouse is over WebBrowser control (InternetExplorer_Server class) in any application (IE, HtmlHelp, Visual Studio, etc.). Is this possible? If yes, then which function I should use?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #3 on: December 14, 2005, 09:03 AM »
ahh... i understand now what you are saying..
but it's beyond my knowledge - skrommel or someone else will know hopefully - definitely should be possible.

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #4 on: December 14, 2005, 11:49 AM »
 :) Here's a script from AHK's help file:

; This example allows you to move the mouse around to see
; the title of the window currently under the cursor:
#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%
return

Skrommel

wasker

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 52
    • View Profile
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #5 on: December 14, 2005, 12:42 PM »
Ah, I see. Thanks!  :Thmbsup:

Here's what I've got. It works as expected so far.

XButton2::
SetTimer, LookForInternetExplorer, 50
return

LookForInternetExplorer:
SetTimer, LookForInternetExplorer, Off
MouseGetPos,,, id, control
IfInString, control, Internet Explorer_Server
{
    Send, {SHIFT down}{LButton}{SHIFT up}
    return
}
else
{
    Send, {XButton2}
    return
}
return

skywalka

  • Member
  • Joined in 2005
  • **
  • Posts: 254
    • View Profile
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #6 on: December 15, 2005, 01:18 AM »
I use the Maxthon browser (the best browser ever) which has an option 2 open links in a new tab via the middle mouse button.

Is it possible 2 open links with the middle mouse button from outside Maxthon itself.  ie Outlook Express & the Favorites bar etc?

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #7 on: December 15, 2005, 01:49 AM »
 :-\ You could send a RightClick and choose Copy Shortcut or something from the menu, depending on the window beneath the cursor, and then Run or paste it.

Skrommel
« Last Edit: December 15, 2005, 01:51 AM by skrommel »

skywalka

  • Member
  • Joined in 2005
  • **
  • Posts: 254
    • View Profile
    • Donate to Member
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #8 on: December 15, 2005, 01:55 AM »
OK.  Thanx.