AutoHotKey code snippets to make you work faster in Google Chrome.
1. The most useful custom shortcuts
| Key | Action |
| Win+a or F1 | Switch to previous tab |
| Win+s or F2 | Switch to next tab |
| Win+z | Go back |
| Win+x | Go forward |
| Win+c or F4 | Close current tab |
| Win+v | Paste and go |
| Win+Alt+v | Paste and go in a new tab |
| F12 | Undo last tab |
| CAPS | Switch to Chrome and create a new tab (If Chrome isn’t already running, it opens Chrome first) |
; Reference: ^ = Ctrl, ! = Alt, + = Shift, # = Win
; Source & Credits: http://www.autohotkey.com/forum/viewtopic.php?p=218283, http://lifehacker.com/5046035/tabslock-puts-your-browser-one-keystroke-away
; Relevant blog post: http://www.howtotuts.com/2008/09/05/how-to-set-keyboard-shortcuts-in-chrome/
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#IfWinActive ahk_class Chrome_XPFrame
~#a::Send,^+{Tab}
~#s::Send,^{Tab}
~#z::Send,!{Left}
~#x::Send, !{Right}
~#c::Send, ^{F4}
#v:: Send !d^v{Enter}
!#v:: Send ^t!d^v{Enter}
F1::Send ^+{Tab}
F2::Send ^{Tab}
F4::Send ^{F4} ;close current tab
F12::Send ^+t ;undoclosetab
#IfWinActive
Capslock::
if WinExist("ahk_class Chrome_XPFrame")
{
WinActivate
WinWaitActive
Send, ^t
}
else
{
EnvGet, USERPROFILE, USERPROFILE
Run "%USERPROFILE%\Local Settings\Application Data\Google\Chrome\Application\chrome.exe" --no-sandbox
WinWait, ahk_class Chrome_XPFrame
Send, ^t
}
return
+Capslock::Capslock
2. Scroll mouse wheel up and down with the cursor on the tab bar to switch to previous and next tabs
; Relevant blog post: http://www.howtotuts.com/2008/09/07/how-to-switch-tabs-in-chrome-by-using-the-mouse-wheel/
; Credit: http://www.autohotkey.com/forum/viewtopic.php?p=218611#218611
; Author: SKAN - Suresh Kumar A N
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
#IfWinActive ahk_class Chrome_XPFrame
~$WheelDown::
~$WheelUp::
MouseGetPos,, yaxis
IfGreater,yaxis,23, Return
IfEqual,A_ThisHotkey,~$WheelDown, Send ^{PgDn}
Else Send ^{PgUp}
Return
#IfWinActive
3. Press Ctrl+Alt+T to post to Twitter (automatically tinyurls the current page)
; ^ = Ctrl, ! = Alt, + = Shift, # = Win
; Author: Sridhar Katakam (http://www.howtotuts.com/)
#NoEnv ;Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input ;Recommended for new scripts due to its superior speed and reliability.
#IfWinActive ahk_class Chrome_XPFrame
; Posting To Twitter start
^!t:: ;Ctrl+Altt+t ('t' for twitter).
clipboard= ;Empty clipboard
clipboard = javascript:void(open('http://www.myopiclunacy.com/twitit.php?title='+escape(document.title)+'&text='+escape(document.selection?document.selection.createRange().text:(window.getSelection?window.getSelection():(document.getSelection?document.getSelection:'')))+'&url='+escape(location.href),'twitIt','scrollbars=no,width=550,height=250,top=175,left=75,status=yes,resizable=yes')) ;Twitter bookmarklet code
ClipWait, 2 ;Set max seconds (to 2) to wait for until clipboard contains data
Send, !d ;Focus address bar
Sleep, 500 ;Pause half a second
Send, ^v{Enter} ;Paste Twitter bookmarklet URL and press enter
WinWait, Twitter - Google Chrome ;Wait till the posting window appears
WinMove, Twitter - Google Chrome, ,(A_ScreenWidth/2)-(275),(A_ScreenHeight/2)-(125) ;Center the posting window
clipboard = ;Empty the clipboard
Return ;Done
; Posting To Twitter end
#IfWinActive
4. Press Ctrl+Shift+D or Ctrl+Shift+B to bookmark to Delicious
; ^ = Ctrl, ! = Alt, + = Shift, # = Win
; Relevant blog post: http://www.howtotuts.com/2008/09/08/how-to-accelerate-bookmarking-to-delicious-from-chrome/
; Author: Sridhar Katakam (http://www.howtotuts.com/)
; Thanks to: Suresh Kumar (http://www.autohotkey.com/forum/profile.php?mode=viewprofile&u=1820)
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#IfWinActive ahk_class Chrome_XPFrame
; Bookmarking in delicious start
~^+b:: ;Ctrl+Shift+b ('b' for bookmarking)
~^+d:: ; or Ctrl+Shift+d ('d' for delicious)
clipboard = ;Empty clipboard
Send, ^c ;Copy current selected text. Make sure text is selected by dragging the text with mouse and not by double clicking
ClipWait ;Wait for the clipboard to contain text
Notes := clipboard ;Store current selected text in a variable called 'Notes'
clipboard= ;Empty clipboard
clipboard = javascript:(function(){f='http://delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv5','location=yes,links=no,scrollbars=no,toolbar=no,width=550,height=550'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})() ;Delicious bookmarklet code
ClipWait, 2 ;Set max seconds to wait for until clipboard contains data to 2
Send, !d ;Focus address bar
Sleep, 500 ;Pause half a second
Send, ^v{Enter} ;Paste delicious bookmarking URL and press enter
WinWait, Save a Bookmark on Delicious ;Wait till the bookmarking window appears
WinMove, Save a Bookmark on Delicious, ,(A_ScreenWidth/2)-(275),(A_ScreenHeight/2)-(275) ;Center the bookmarking window
Sleep, 4000 ;Pauses 4 seconds
Send, +{Tab} ;Press Shift+Tab so that the cursor is taken to Notes field
Sleep, 50 ;A short pause
Send %Notes% ;Type the earlier selected text
Sleep, 500 ;Pause half a second
Send {Tab} ;Move to Tags field
clipboard = ;Empty the clipboard
Return ;Done
; Bookmarking in delicious end
#IfWinActive
5. Few shortcuts for closing tab, going to previous tab and next tabs, going back and forward Note: Mouse pointer must be having IBeam shape for left and right arrow keys shortcuts
; Reference: ^ = Ctrl, ! = Alt, + = Shift, # = Win
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
~Left::IfNotEqual,A_Cursor,IBeam, Send, ^+{Tab}
~Right::IfNotEqual,A_Cursor,IBeam, Send, ^{Tab}
~$c:: ; Double left-click functionality.
{
If ( A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 300 ) ; Adjust number for sensitivity
{
Send ^{F4}
}
}
Return
~$z:: ; Double left-click functionality.
{
If ( A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 300 ) ; Adjust number for sensitivity
{
Send {Backspace}
}
}
Return
~$x:: ; Double left-click functionality.
{
If ( A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 300 ) ; Adjust number for sensitivity
{
Send !{Right}
}
}
Return
Hello and welcome to (what we aim to be) the ultimate resource for how-tos and tutorials on topics like software, PHP scripts, web mastering, technology, lifestyle and more. If you would like to ask us a question or share your how-to, please 