DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

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

wasker

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 52
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,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #1 on: December 14, 2005, 02:44 PM »
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
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #2 on: December 14, 2005, 02:56 PM »
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,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #3 on: December 14, 2005, 03:03 PM »
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
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #4 on: December 14, 2005, 05:49 PM »
:) Here's a script from AHK's help file:

Code
; 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
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #5 on: December 14, 2005, 06:42 PM »
Ah, I see. Thanks!  :Thmbsup:

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

Code
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
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #6 on: December 15, 2005, 07: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
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: Forward button on Mouse Explorer to Open Link in a New Window
« Reply #7 on: December 15, 2005, 07: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, 07:51 AM by skrommel »

skywalka

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

Original address: https://www.donationcoder.com/forum/index.php?topic=1814.0