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:34 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: Winkey g Google Search ahk quickie  (Read 6031 times)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Winkey g Google Search ahk quickie
« on: January 14, 2016, 03:27 PM »
Here is a quickie hotkey for when you don't have anything open to type into to select text etc.. and want to type in a string to search Google with the default browser.  If the InputBox is closed via OK Button it sounds a tone as indication the browser is being launched.

I just added the snippet below to my general purpose ahk hotkey script.

Code: Autohotkey [Select]
  1. ;Winkey g to search Google using default browser
  2. #g::
  3.   InputBox,SearchVar,Google Search,Enter String for Google to Find
  4.   If (ErrorLevel)
  5.     return
  6.   ;MsgBox I would search Google for %SearchVar%
  7.   Run, http://www.google.com/search?q=%SearchVar%
  8.   SoundPlay,*64
  9.   return

Curt

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 7,566
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #1 on: January 14, 2016, 04:40 PM »
is it easy to change the hotkey combination?

WinKey+G
Activates the new Xbox game bar to let you record games or take screenshots.
-Win 10

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #2 on: January 14, 2016, 05:28 PM »
is it easy to change the hotkey combination?

what do you want to change it to?

Screenshot - 2016-01-15 , 00_21_46.png

^This^ is the bit you need to change -- I always forget (I *think Ctrl='^'), and need to look up the AHK site.
I know from the screenshot that:
# = Winkey
and that's it....

so,
only half a solution -- or maybe just a quarter ;-)
Tom

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #3 on: January 15, 2016, 06:58 AM »
The list of hotkey prefix keys is here:
https://autohotkey.c.../Hotkeys.htm#Symbols

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #4 on: January 16, 2016, 04:46 PM »
For Firefox users, it might be worth noting here about the search prefixes offered by the Instantfox Firefox add-on - http://www.instantfox.net/
You just type in to the URL bar. You could also (say) invoke them with FARR aliases, like the "dc searchstring" I use for searching in the DC forum.
Prefix keys (which can be changed by the user) include, for example:
g » G/Search  | e » eBay
i » G/Images   | b » Bing
m » G/Maps    | yh » Yahoo
y » YouTube    | a » Amazon
t » Twitter        | f » W.f/cast
w » Wikipedia  | c » Calculator
wa » WolframAlpha

I don't always remember the correct prefixes to use, so I have them on a Stick A Note that can be brought up in the top RH corner on any web page in Firefox. (Kudos to @anandcoral.)

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,540
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #6 on: January 17, 2016, 06:57 AM »
You could also (say) invoke them with FARR

Speaking of FARR, one thing I ignored for years was the Windows desktop and folder behavior of searching as you type.  As example I have a folder on the desktop called Programs with categories of shortcuts in other folders.  I was clicking Programs, then clicking System_Utils then clicking DiskTolls.. very slow.  Now I remember to open Programs folder, type sys<enter> then type dis<enter> then click the utility.  Likewise I pit most of my desktop icons in a folder Desktop.  I click to open it, then for Macrium Reflect, instead of hunting it down I type ref<enter> without looking.  Or mbam<enter> for malwarebytes.  For stuff I use frequently but not often enough for a Taskbar shortcut, it obviates the need to search or use the start menu in most cases.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #7 on: January 17, 2016, 07:04 AM »
An exercise for the reader may be to make a GUI in AHK that has 1/2 dozen search engines and pops up with a hotkey.  The default button would be he default search engine etc..

I haven't looked through the list.  skwire may have already done it.  :)

Doesn't have to be just google type stuff.  You could have an entry for Everything Search, any number of NirSoft utilities etc..  Only thing is opening everything(meaning many different programs) with a hotkey, when you get on a machine without that hotkey utility you hit the key combination from habit.  :)


Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #8 on: January 17, 2016, 01:52 PM »
Doesn't have to be just google type stuff.  You could have an entry for Everything Search, any number of NirSoft utilities etc.. 
FARR is easy and great for this. As long as the "targets" (google in browser, everything, ...) support command line parameters we can make FARR aliases to launch them with a searchstring.

For example I use two spaces at the end of a FARR searchphrase as an alias trigger to pass the search on to Everything. Very handy as you can first search with FARR and, if what you're looking for isn't found in a second or two, just tap space space.

To set it up in FARR create a new alias and put this in the regular expressions box:
^(.*)\s\s$
And this in the results box:
Everything Search: $$1 | dolaunch C:\Program files\Everything\Everything.exe -search "$$1"
(Your path to Everything may vary)

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #9 on: January 17, 2016, 04:33 PM »
FARR is easy and great for this.

I understand.  I used aliases with it myself.  But sometimes it is nice to have something dedicated to only a few things or even a single thing.  But my original point was that it is easy to forget you can search for an icon by typing its name.  The tendency is to try to decipher the little graphic.  One can get distracted by the pictures.  If I use larger icons the picture is easier to see but I have fewer of them visible without scrolling, in the case of a folder full of icons.



MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Re: Winkey g Google Search ahk quickie
« Reply #10 on: June 30, 2016, 09:26 AM »
I got the idea to adapt the google quickie search hotkey, Winkey g, to utilize BrowserBunch.exe.  Now to google precede the search terms with "g " (g and a blank space.)  Also the search string is now scanned for spaces.  "%20" is substituted for spaces in the search string to avoid it being "chopped" at the first space on the command line.

Type in a URL instead to open a browser.  You will need to update the path to BrowserBunch.exe to match the location on your system.  I find this handy for bypassing stuff like the browser trying to open a Speed Dial before letting me type into the address bar.  Plus instead of relying on the default browser setting you can use the browser that works best or opens fastest etc.. on the page in question.

Here is the code snippet.  Edit: I don't know if there is a way to turn off wrapping in the edit applet thingie.  If you get errors look for wrapped lines that shouldn't be.  :)

Code: Autohotkey [Select]
  1. #g::
  2.   InputBox,SearchVar,Google Search,Enter Browser URL (precede with "g " for Google Search)
  3.   If (ErrorLevel)
  4.     return
  5.   StringLeft,TempStr,SearchVar,2
  6.   If (TempStr != "g ")
  7.     Run,C:\Utils\BrowserBunch\BrowserBunch.exe %SearchVar%
  8. else
  9. {
  10.   StringMid,SearchVar,SearchVar,3
  11.   If (InStr(SearchVar," "))
  12.     SearchVar := StrReplace(SearchVar," ","`%20")
  13.   Run,C:\Utils\BrowserBunch\BrowserBunch.exe  http://www.google.com/search?q=%SearchVar%
  14. }
  15.  
  16.   SoundPlay,*64
  17.   return
« Last Edit: June 30, 2016, 09:44 AM by MilesAhead »