This script aims to workaround the retarded decision of Google to remove these settings some time ago.
It does two things:
* It will open in new tab whenever you type in the Address Bar and press Enter
* It will open in new tab any immediate bookmarks from the bookmarks bar(Ctrl+LMB should open in same tab)
Code is edited after I got tremendous help from an user on Reddit "anonymous1184". It now needs the Acc library to work but is much simpler and user friendly that way!
Code: Select all
;!-Alt/+-Shift/^-Control/#-win
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
;#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
/****************************************
GUI For Logger (uncomment if you want to look at logs)
*/
Gui +AlwaysOnTop Resize
Gui, Add, Edit, x5 y5 w228 h1658 vConsole
Gui, Show, x3535 y0 w238 h1666, Logger AHK
/****************************************
LOGGER Logic (uncomment if you want to look at logs. uncomment all lines with log() below!)
*/
log(msg) {
FormatTime, TimeString, A_Now, HH:mm:ss ; Generates a time stamp
GuiControlGet, Console
GuiControl, , Console, %Console%[%TimeString%] %msg%`r`n ; GUI write
}
/****************************************
Chrome Fix
*/
LButton::
{
MouseGetPos,,,guideUnderCursor
WinGetClass, Title, ahk_id %guideUnderCursor%
WinGetActiveTitle, activeTitle
if (Title == "Chrome_WidgetWin_1") and not WinActive("ahk_exe Chrome.exe"){
log("LMB inside Inactive Chrome")
sendLButton()
} else
{
log("LMB Outside Chrome")
sendBlindLButton()
}
Return
}
^LButton::
{
MouseGetPos,,,guideUnderCursor
WinGetClass, Title, ahk_id %guideUnderCursor%
WinGetActiveTitle, activeTitle
if (Title == "Chrome_WidgetWin_1") and not WinActive("ahk_exe Chrome.exe")
{
log("Ctrl+LMB inside Inactive Chrome")
sendLButton(true)
}
else
{
log("Ctrl+LMB Outside Chrome")
sendBlindLButton()
}
Return
}
sendLButton(ctrl=false)
{
desc := ""
objectP := Acc_ObjectFromPoint()
try desc := objectP.accDescription(0)
if (desc ~= "i)^http|www") and not ctrl
{
log("Bookmark: Sending Ctrl+LMB")
Send ^{Click}{Alt down}{Alt up}
}
else if (desc ~= "i)^http|www") and ctrl
{
log("Bookmark: Sending LMB")
Send {Click}
}
else
{
log("Not a Bookmark")
sendBlindLButton()
}
}
sendBlindLButton()
{
Send {Blind}{LButton Down}
KeyWait LButton
Send {Blind}{LButton Up}
}
#IfWinActive ahk_exe chrome.exe
^LButton::
log("Ctrl+LMB inside Active Chrome")
sendLButton(true)
return
LButton::
log("LMB inside Active Chrome")
sendLButton()
return
$Enter::
log("Enter inside Active Chrome")
path := "4.1.1.1.1.2.5.3"
exist := WinExist()
objectW := Acc_ObjectFromWindow(exist, 0)
Send % (Acc_Get("Focus", path,, objectW) = 0 ? "!" : "") "{Enter}"
return
#IfWinActive