Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Keyboard Shortcut - Go to the Next Page in Google Search Results
#1
Lightbulb 
If you use Google Search a lot, scrolling and clicking to bring up the next page of results can be a real pain. Using the "Run AutoHotkey code" command in ShortKeeper (with the following script) will allow you to easily create a keyboard shortcut to do this without having to use your mouse.

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
LastTitleMatchMode := A_TitleMatchMode
SetTitleMatchMode 2
if WinActive("Google Search")
{
  Send ^l
  Sleep 200
  SendInput javascript: document.getElementById("pnnext").click()
  Sleep 200
  Send {enter}
}
SetTitleMatchMode %LastTitleMatchMode%

This script was successfully tested on May 21, 2021 with Edge, Chrome, and Internet Explorer (IE).

The instructions to go to the next page (lines #5 to #9) will be executed only if the active window title includes "Google Search".

If ever Google changes the way its search webpage works, this script may stop working. Please report any problems here. This will allow someone to correct the script. Just subscribe to this thread to be notified of any updates.
Enterpad: For those who need more than a few shortcuts.

Reply
#2
Lightbulb 
Hello denilama,

I found your AHK script quite useful! Basing on yours, here's a slight modification which can potentially speedup 200ms:

Code:
LastTitleMatchMode := A_TitleMatchMode
SetTitleMatchMode 2
if WinActive("Google Search")
    Send ^l
    Sleep 200
    SendInput javascript:document.getElementById("pnnext").click()`n
}
SetTitleMatchMode %LastTitleMatchMode%

In addition, non-English users (for example Chinese) have to change to RegEx matching mode to make it work:

Code:
SetTitleMatchMode RegEx
if WinActive("Google\s\x{641c}\x{5c0b}") {  ; "Google 搜尋"
; or WinActive("Google\s\x{641c}\x{5bfb}")  ; "Google 搜寻"

Cheers,
davidhcefx
Reply
#3
Thank you davidhcefx for the improved code.
Enterpad: For those who need more than a few shortcuts.

Reply
#4
(03-16-2022, 12:22 PM)denilama Wrote: Thank you davidhcefx for the improved code.

hey, I followed your guide but when I pressed ctrl-N nothing happened, does the script still work?
Reply
#5
What exact code did you use?
What is your AutoHotkey version?
Enterpad: For those who need more than a few shortcuts.

Reply
#6
(07-02-2024, 02:39 PM)denilama Wrote: What exact code did you use?
What is your AutoHotkey version?

it seems the browser was the problem, script does nothing on Firefox, Im using  AutoHotKey v1.1.37.02 thats included with latest ShortKeeper version

 code I used
Quote:
Code:
LastTitleMatchMode := A_TitleMatchMode
SetTitleMatchMode 2
if WinActive("Google Search")
{
  
Send ^l
  
Sleep 200
  
SendInput javascript: document.getElementById("pnnext").click()
  
Sleep 200
  
Send {enter}
}
SetTitleMatchMode %LastTitleMatchMode%
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)