Google, Dictionary, Thesaurus Search

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Google, Dictionary, Thesaurus Search

07 May 2015, 16:47

Google Search
Preforms a google search of highlighted text or text input if no text is highlighted using the default browser.

Code: Select all

; Google
; Fanatic Guru
; 2016 03 15
; Version: 1.21
;
; Google Search of Highlighted Text
;
;{-----------------------------------------------
; If Internet Explorer is already running it will add search as new tab
;}

; INITIALIZATION - ENVIROMENT
;{-----------------------------------------------
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force  ; Ensures that only the last executed instance of script is running
;}

; AUTO-EXECUTE
;{-----------------------------------------------
;
RegRead, ProgID, HKEY_CURRENT_USER, Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice, Progid
Browser := "iexplore.exe"
if (ProgID = "ChromeHTML")
   Browser := "chrome.exe"
if (ProgID = "FirefoxURL")
   Browser := "firefox.exe"
if (ProgID = "AppXq0fevzme2pys62n3e0fbqa7peapykr8v")
   Browser := "microsoft-edge:"

;
;}-----------------------------------------------
; END OF AUTO-EXECUTE

; HOTKEYS
;{-----------------------------------------------
;
#g::    ; <-- Google Web Search Using Highlighted Text
   Search := 1
   Gosub Google
return

^#g::    ; <-- Google Image Search Using Highlighted Text
   Search := 2
   Gosub Google
return

!#g::    ; <-- Google Map Search Using Highlighted Text
   Search := 3
   Gosub Google
return
;}

; SUBROUTINES
;{-----------------------------------------------
;
Google:
   Save_Clipboard := ClipboardAll
   Clipboard := ""
   Send ^c
   ClipWait, .5
   if !ErrorLevel
      Query := Clipboard
   else
      InputBox, Query, Google Search, , , 200, 100, , , , , %Query%
   StringReplace, Query, Query, `r`n, %A_Space%, All 
   StringReplace, Query, Query, %A_Space%, `%20, All
   StringReplace, Query, Query, #, `%23, All
   Query := Trim(Query)
   if (Search = 1)
      Address := "http://www.google.com/search?hl=en&q=" Query ; Web Search
   else if (Search = 2)
      Address := "http://www.google.com/search?site=imghp&tbm=isch&q=" Query ; Image Search
   else
      Address := "http://www.google.com/maps/search/" Query ; Map Search
   if (Browser = "iexplore.exe")
   {
      Found_IE := false
      For wb in ComObjCreate("Shell.Application").Windows 
         If InStr(wb.FullName, "iexplore.exe")
         {
            Found_IE := true
         	break
         }
      if Found_IE
         wb.Navigate(Address, 2048) 
      else
      {
         wb := ComObjCreate("InternetExplorer.Application")
         wb.Visible := true
         wb.Navigate(Address) 
      }
      WinHwnd := wb.HWND
      WinActivate ahk_id %WinHwnd%
   }
   else
      Run, %browser% %Address% 
   Clipboard := Save_Clipboard
   Save_Clipboard := ""
return
;}
Dictionary Search
Preforms a dictionary search at Dictionary.com of the highlighted text or text input if no text is highlighted. The results are trimmed down and displayed in a Gui using an ActiveX control.
  • When Gui is active, can double click on word in Gui to then search for that word.
  • When Gui is active, can use Left and Right arrows to move back and forth through history.

Code: Select all

; Dictionary
; Fanatic Guru
; 2016 03 10
; Version: 1.21
;
; Dictionary Search at Dictionary.com
;
;{-----------------------------------------------
; Downloads http text from website and trim it down and format for display in ActiveX Gui
;}

; INITIALIZATION - ENVIROMENT
;{-----------------------------------------------
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force  ; Ensures that only the last executed instance of script is running
SetControlDelay -1 
;}

; INITIALIZATION - VARIABLES
;{-----------------------------------------------
;
History := {}
HP := 0
HB := 1
HM := 15 ; Maximum Word History
W := Floor(A_ScreenWidth / 3)
H := Floor(A_ScreenHeight / 3)
;}

; INITIALIZATION - GUI
;{-----------------------------------------------
;
Gui +LabelDictionaryGui
Gui, Margin, 0, 0
Gui, +Resize
Gui, Add, ActiveX, w%W% h%H% vDisplay hwndHtmlControl, HTMLFile
ComObjConnect(Display, "Doc_")
;}

; HOTKEYS
;{-----------------------------------------------
;
#d::	;<-- Dictionary Search Using Highlighted Text
	Hotkey_Start:
	Word := ""
	Save_Clipboard := ClipboardAll
	Clipboard := ""
	Send ^c
	ClipWait, .5
	Word := Clipboard
	Clipboard := Save_Clipboard
	Save_Clipboard := ""
	if !Word
	{
		InputBox Word, Define Word, Enter word to define., , 200, 120
		if (ErrorLevel or !Word)
			return
	}
	HT := ++HP
	If (HT - HB > HM)
		History[HB] := "", HB ++
	Display.body.innerHTML := Get_Definition_Html(RegExReplace(Word, "[^\w\s]"))
	RemoveNodeByClassName(Display
	, "ipapron" 
	, "headword-bar-list" 
	, "pronounce-button"
	, "syllable-button"
	, "button-source"
	, "tail-wrapper"
	, "video-content"
	, "audio-wrapper"
	, "deep-link-synonyms")
	History[HP] := Display.body.innerHTML
	Display:
	Display.selection.empty()
	Display.parentWindow.scrollTo(0,0)
	Gui, Show
return

#ifWinActive, Dictionary.ahk ahk_class AutoHotkeyGUI
Left::		;<-- History Back
	if (HP > HB)
	{
		Display.body.innerHTML := History[--HP]
		gosub Display
	}
return

Right::		;<-- History Forward
	if (HP < HT)
	{
		Display.body.innerHTML := History[++HP]
		gosub Display
	}
return
;}

; SUBROUTINES - GUI
;{-----------------------------------------------
;
DictionaryGuiSize:
	GuiControl, Move, %HtmlControl%, W%A_GuiWidth% H%A_GuiHeight%
return

DictionaryGuiClose:
DictionaryGuiEscape:
	Gui Show, Hide
	HP := HT
return
;}

; FUNCTIONS
;{-----------------------------------------------
;
Get_Definition_Html(Word)
{
	if !whr
		whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	whr.Open("GET", "http://dictionary.reference.com/browse/" Word "+?s=t", true)
	whr.Send()
	whr.WaitForResponse()
	Http_Text := whr.ResponseText
	if RegExMatch(Http_Text, "sU)Did you mean <a href=.*<span class=""me"" .*>(.*)</span>",Match)
		return "<font size=""4em"">Did you mean </font><font size=""6em""><b>" Match1 "</b>?</font>"
	if RegExMatch(Http_Text,"sU)(<div class=""center-well-container"".*)<div class=""source-meta"">", Section)
		Section := Section1
	else
		return "<h1>" Word "</h1><h2>NO results found on Dictionary.com</h2>"
	Section := RegExReplace(Section, "\(<span class=""prontoggle pronounce-inline"">Show IPA</span>\)")
	Section := RegExReplace(Section, "sU)<a [^>]*href=[^>]*>(.*)</a>","$1")
	Section := RegExReplace(Section, "sU)<header class=""luna-data-header"">(.*)</header>","<h3 style=""margin-top: .5em; margin-bottom: 0em; text-decoration: underline;"">$1</h3>")
	Section := RegExReplace(Section, "sU)<div class=""def-block def-inline-example"">(.*)</div>","$1")

	Section =
	(
	%Section%
	<style>
	.head-entry {margin-bottom: 0em; font-size: 2em;}
	.dbox-example {color:gray;}
	.dbox-italic {font-style:italic;}
	.dbox-bold {font-weight:bold;}
	.def-sub-list {margin: -.1em 0em .5em 2em; list-style-type: lower-alpha}
	.def-content {margin: -1.1em 0em 0em 2em;}
	.def-block-label-synonyms {margin-left: 1em;}
	</style>
	)
	return Section
}

RemoveNodeByClassName(ByRef Doc, Names*)
{
	for index, Name in Names
		Needle .= Name "|"
	Needle := "i)\b" SubStr(Needle,1,-1) "\b"
	list := Doc.getElementsByTagName("*")
	Count := list.length
	loop %Count%
		if (child := list[Count-A_Index])
			if (child.className ~= Needle)
				child.parentNode.removeChild(child)
	return
}
;}

; FUNCTIONS - GUI
;{-----------------------------------------------
;
Doc_OnKeyPress(Doc)
{
    static keys := {1:"selectall", 3:"copy", 22:"paste", 24:"cut"}
    keyCode := Doc.parentWindow.event.keyCode
	If keys.HasKey(keyCode)
		Doc.ExecCommand(keys[keyCode])
}

Doc_OnDblClick() 
{
	gosub Hotkey_Start
}
;}
Thesaurus Search
Preforms a thesaurus search at Thesaurus.com of the highlighted text or text input if no text is highlighted. The results are trimmed down and displayed in a Gui using an ActiveX control.
  • When Gui is active, can double click on word in Gui to then search for that word.
  • When Gui is active, can use Left and Right arrows to move back and forth through history.
  • When Gui is active, can use Tab to move to box at top to enter new word.

Code: Select all

; Thesaurus
; Fanatic Guru
; 2016 03 15
; Version: 1.0
;
; Thesaurus Search at Thesaurus.com
;
;{-----------------------------------------------
; Downloads http text from website and trim it down and format for display in ActiveX Gui
;}

; INITIALIZATION - ENVIROMENT
;{-----------------------------------------------
;
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force  ; Ensures that only the last executed instance of script is running
SetControlDelay -1 
;}

; INITIALIZATION - VARIABLES
;{-----------------------------------------------
;
History := {}
HP := 0
HB := 1
HM := 15 ; Maximum Word History
W := 700
H := 400
Style =
(
<style>
ul {
	padding: 1em;
	margin: -1em 0em 0em 2em;
	float: left;
}

.heading-row {
	clear: left;
}

H2 {
	margin: .1em 0em .1em 0em;
}

.header-antonyms {
	margin: -.3em 0em 0em 0em;
	font-size: 1.25em;
}

.synonym-description {
	border-top: 1px solid black;
	border-bottom: 1px solid black;
}

.synonyms-horizontal-divider {
	position: relative;
	top: -3.1em;
	border-top: 1px solid black;
	border-bottom: 2px solid black;
}
</style>
)

;}

; INITIALIZATION - GUI
;{-----------------------------------------------
;
Gui +LabelThesaurusGui
Gui, Margin, 0, 0
Gui, +Resize +MinSize700x400
Gui, Font, s18 Bold, Verdana
Gui, Add, Edit, 0x8 0x1 -VScroll r2 x0 y0 w%W% vBanner gBanner_Enter hwndBannerControl
GuiControl, Move, Banner, h38
Gui, Add, ActiveX, x0 y38 w%W% h%H% vDisplay hwndHtmlControl, HTMLFile
ComObjConnect(Display, "Doc_")
oHTML := ComObjCreate("HTMLfile")
oHTML.write("<div>Initilize</div>")
;}

; HOTKEYS
;{-----------------------------------------------
;
#!d::	;<-- Thesaurus Search Using Highlighted Text
	Hotkey_Start:
	Save_Clipboard := ClipboardAll
	Clipboard := ""
	Send ^c
	ClipWait, .5
	Word := Clipboard
	Clipboard := Save_Clipboard
	Save_Clipboard := ""
	Display.body.innerHTML := ""
	Banner_Input:
	if Word
	{
		Word := RegExReplace(Word, "[^\w\s]")
		HT := ++HP
		If (HT - HB > HM)
			History[HB] := "", HB ++
		
		oHTML.body.innerHTML := Get_Html("http://thesaurus.com/browse/" Word)
		oHTML.body.innerHTML := GetNodesByClassName(oHTML,"synonyms_wrapper")[1].outerHTML Style
		StripElements(oHTML, "A")
		RemoveNodesByClassName(oHTML
		, "citation"
		, "star inactive"
		, "tabset"
		, "form-block"
		, "synonyms-heading"
		, "misspell-bottom")
		oHTML.body.innerHTML := RegExReplace(RegExReplace(oHTML.body.innerHTML,"U)<H2>Antonyms.*</H2>", "<H2 class=header-antonyms>Antonyms</H2>"), "U)<H2>Synonyms.*</H2>", "<H2>Synonyms</H2>")
		Display.body.innerHTML := oHTML.body.innerHTML
		History[HP,"Body"] := Display.body.innerHTML
		History[HP,"Word"] := Word
	}
	Display:
	GuiControl,, Banner, %Word%
	if Word
		GuiControl, Focus, Display
	else
		GuiControl, Focus, Banner
	Display.selection.empty()
	Display.parentWindow.scrollTo(0,0)
	Gui, Show
return

#ifWinActive, Thesaurus.ahk ahk_class AutoHotkeyGUI
Left::		;<-- History Back
	if (HP > HB)
	{
		--HP
		Display.body.innerHTML := History[HP,"Body"]
		Word := History[HP,"Word"]
		gosub Display
	}
return

Right::		;<-- History Forward
	if (HP < HT)
	{
		++HP
		Display.body.innerHTML := History[HP,"Body"]
		Word := History[HP,"Word"]
		gosub Display
	}
return
;}

; SUBROUTINES - GUI
;{-----------------------------------------------
;
ThesaurusGuiSize:
	GuiControl, Move, %HtmlControl%, % "W" A_GuiWidth " H" A_GuiHeight-36
	GuiControl, Move, %BannerControl%, % "W" A_GuiWidth  
return

ThesaurusGuiClose:
ThesaurusGuiEscape:
	Gui Show, Hide
	HP := HT
return

Banner_Enter:
	Gui, Submit, NoHide
	if Banner contains `n
	{
		Word := Trim(Banner, " `t`n")
		gosub Banner_Input
	}
	return
;}

; FUNCTIONS
;{-----------------------------------------------
;
Get_HTML(Http)
{
	if !whr
		whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	whr.Open("GET", Http, true)
	whr.Send()
	whr.WaitForResponse()
	return whr.ResponseText
}

GetNodesByClassName(ByRef Doc, Names*)
{
	Nodes := {}
	for index, Name in Names
		Needle .= Name "|"
	Needle := "i)\b" SubStr(Needle,1,-1) "\b"
	list := Doc.getElementsByTagName("*")
	Count := list.length
	loop %Count%
		if (child := list[A_Index-1])
			if (child.className ~= Needle)
				Nodes.Push(child)
	return Nodes
}

RemoveNodesByClassName(ByRef Doc, Names*)
{
	for index, Name in Names
		Needle .= Name "|"
	Needle := "i)\b" SubStr(Needle,1,-1) "\b"
	list := Doc.getElementsByTagName("*")
	Count := list.length
	loop %Count%
		if (child := list[Count-A_Index])
			if (child.className ~= Needle)
				child.parentNode.removeChild(child)
	return
}

StripElements(ByRef Doc, Elements*)
{
	for index, Element in Elements
	{
		list := Doc.getElementsByTagName(Element)
		Count := list.length
		loop %Count%
			list[Count-A_Index].outerHTML := list[Count-A_Index].innerHTML
	}
	return Count
}
;}

; FUNCTIONS - GUI
;{-----------------------------------------------
;
Doc_OnKeyPress(Doc)
{
    static keys := {1:"selectall", 3:"copy", 22:"paste", 24:"cut"}
    keyCode := Doc.parentWindow.event.keyCode
	If keys.HasKey(keyCode)
		Doc.ExecCommand(keys[keyCode])
}

Doc_OnDblClick() 
{
	gosub Hotkey_Start
}
;}
FG
Last edited by FanaticGuru on 15 Mar 2016, 12:26, edited 7 times in total.
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
Iomega0318
Posts: 83
Joined: 06 Apr 2015, 14:56
Location: Wolfforth, TX
Contact:

Re: Google and Dictionary Search

08 May 2015, 15:08

This looks interesting :)
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google and Dictionary Search

13 May 2015, 17:07

Updated Dictionary on First Page

Version: 1.1
Change Log: 2015-05-13

  • General improvements in formatting and display of html
  • Used html styles to format text instead of RegExReplace for most of the formatting
  • Added ability to use Ctrl-C to copy from Gui
  • Added ability to select text in Gui then hit hotkey to find the definition of a word within a definition
  • Added ability to Double Click on a word in the Gui to find the definition of a word within a definition
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
AlleyArtwork
Posts: 44
Joined: 09 Jun 2015, 21:08

Re: Google and Dictionary Search

11 Jun 2015, 20:26

This dictionary search is fantastic!
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Google and Dictionary Search

11 Jun 2015, 21:13

This is awesome! How about throwing in a back button?
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

12 Jun 2015, 18:38

It's a very fast, mind blowing idea! (Not only for dictionary. I already imagine adds free browsing!)
P.s.: Yes, skipping back-forth either in form of buttons or Alt-Left-Right respectively would be conducive!
P.p.s.: I noticed, that after Ctrl-A and in some lines highlighting till linefeed, Ctrl-C copies to clipboard more then just in Gui displayed text.

regards!
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google and Dictionary Search

18 Jun 2015, 18:31

Updated Dictionary on First Page

Version: 1.2
Change Log: 2015-06-18

  • Remove unneeded information through Html DOM instead of using CSS to set to Display:none (Display:none still allowed the information to show up during Copy & Paste)
  • Added History, when Gui is active Left and Right Arrows go back and forth through history
It is worth noting that an HtmlFile does not seem to support getElementsByClassName so I added a function to walk through the DOM by getElementsByTagName and then checked those for the proper ClassName to remove then used child.parentNode.removeChild(child) to remove the unneeded nodes. I could have done it with a RegEx function but I wanted to figure out how to do it with DOM. I spent a good deal of time banging my head trying to make getElementsByClassName work trying ever way I could think of before I gave up on it.

Html DOM is great but tricky to figure out what all you can do as document objects, web browser objects, CSS, JavaScript etc. all flow together and overlap.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

19 Jun 2015, 23:29

Once again,

Brilliant, brilliant, brilliant!!!

Thank you so much FanaticGuru!
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

06 Jul 2015, 11:07

Hi, again!

Still enthusiastic about your Dictionary. One more question 'cause didn't 've profound study of your code yet.
Will it work forever? What if they change site conception?

Thank you, forever!
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google and Dictionary Search

06 Jul 2015, 12:41

rommmcek wrote:Hi, again!

Still enthusiastic about your Dictionary. One more question 'cause didn't 've profound study of your code yet.
Will it work forever? What if they change site conception?

Thank you, forever!
The script depends on Dictionary.com to get the definitions. If the html code that site returns when a definition request is sent changes significantly then the script will need to be modified. The modifications should not be that difficult.

The script is one of my standard bootup scripts that is always running on my computer so I intent to keep it updated for the foreseeable future.

At some point when I get the time I would like to add a script that does a similar thing for thesaurus.com to display synonyms and antonyms.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

06 Jul 2015, 14:50

Thanks for prompt answer!
I'm running it all the time too! Unfortunately am I not on the line all the time.
Thrilling to see FG thesaurus.com
Hoping to comprehend tricks thoroughly soon!

bye!
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

08 Mar 2016, 20:57

That's what I was scared of! Dictionary doesn't work anymore.

I modified your editor like behavior for history and made saving it to file.
I added "Word origin" and <br> at the end, to show all content in every case.
I added "More suggestions" after "Did you mean ...?".
So at first I thought that my modifications were the reason.

But then even your original script responses with "NO results found on Dictionary.com" only.
Too bad!

Here is my Thesaurus.com based on modified Dictionary.ahk, with a bit uncommon and even inconsequent approach.
I think the site was easier to decipher and still works. (Probably wasn't modified yet!)

bye!

Edit: Update!
Attachments
iThesaurus1.0.5.ahk
(13.01 KiB) Downloaded 423 times
Last edited by rommmcek on 16 Mar 2016, 16:48, edited 1 time in total.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

09 Mar 2016, 21:04

Adding s to RegExMatch seems to solve the problem!, so:

Code: Select all

  if RegExMatch(Http_Text,"sU)(<div class=""center-well-container"".*)<div class=""source-meta"">", Section)
    Section := Section1 "`n<br>"
works fine enough for me.

Edit: With this replace works better without -s option:

Code: Select all

stringreplace, Http_Text, Http_Text, `r,, all
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google and Dictionary Search

10 Mar 2016, 03:35

Updated Dictionary on First Page

Version: 1.21
Change Log: 2016-03-10

  • Added s flag to RegEx where need to accommodate for stray `n or `r in HTML code
  • Removed node that advertised Thesaurus.com
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google and Dictionary Search

10 Mar 2016, 23:47

Thank you FG, for a professional update!
I just got addicted to this great idea of yours!
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google, Dictionary, Thesaurus Search

15 Mar 2016, 12:19

Updated Google on First Page

Version: 1.21
Change Log: 2016-03-15

  • Add Microsoft Edge as a possible browser default
Added Thesaurus on First Page

Version: 1.0
Change Log: 2016-03-15

  • Has a better gui than Dictionary that shows the word in a box at the top
  • Can {tab} to move to the box at top and enter new word
FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Google, Dictionary, Thesaurus Search

16 Mar 2016, 04:36

Awesome display style in Thesaurus Search!!!

Thanks!

P.s.: Why do you stick with this editor like history behavior?
becritical
Posts: 15
Joined: 23 May 2016, 03:28

Re: Google, Dictionary, Thesaurus Search

17 Nov 2016, 08:06

I can't see to get this to work, I get "failed attempt to launch program or document, action <http.......> params:<> the system cannot find the file specified and a pointer to line Run,%browser% %address% and I have checked the registry entry it is correct it points to firefoxURL
User avatar
FanaticGuru
Posts: 1905
Joined: 30 Sep 2013, 22:25

Re: Google, Dictionary, Thesaurus Search

17 Nov 2016, 20:23

becritical wrote:I can't see to get this to work, I get "failed attempt to launch program or document, action <http.......> params:<> the system cannot find the file specified and a pointer to line Run,%browser% %address% and I have checked the registry entry it is correct it points to firefoxURL
The script does Run, firefox.exe. Maybe you have Firefox installed somewhere that Windows is not able to find it.
This is the part that tries to figure out what the default browser is on the system.

Code: Select all

RegRead, ProgID, HKEY_CURRENT_USER, Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice, Progid
Browser := "iexplore.exe"
if (ProgID = "ChromeHTML")
   Browser := "chrome.exe"
if (ProgID = "FirefoxURL")
   Browser := "firefox.exe"
if (ProgID = "AppXq0fevzme2pys62n3e0fbqa7peapykr8v")
   Browser := "microsoft-edge:"
You might change the line Browser := "firefox.exe" to include the entire path to firefox.exe.

FG
Hotkey Help - Help Dialog for Currently Running AHK Scripts
AHK Startup - Consolidate Multiply AHK Scripts with one Tray Icon
Hotstring Manager - Create and Manage Hotstrings
[Class] WinHook - Create Window Shell Hooks and Window Event Hooks
becritical
Posts: 15
Joined: 23 May 2016, 03:28

Re: Google, Dictionary, Thesaurus Search

01 Feb 2017, 07:22

Thank you but I am not having any luck! I changed to the full path and also checked the windows registry exists and it's exact and it is FirefoxURL.
I still get the same message. "failed to lunch program...." Action: <http://www.google.com/search.... q=UserChoice"

RegRead, ProgId, HKEY_CURRENT_USER, Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice, Progid
Browser := "iexplore.exe"
if (ProgID = "ChromeHTML")
Browser := "chrome.exe"
if (ProgID = "FirefoxURL")
Browser := "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
if (ProgID = "AppXq0fevzme2pys62n3e0fbqa7peapykr8v")
Browser := "microsoft-edge:

Any idea?

FanaticGuru wrote:
becritical wrote:I can't see to get this to work, I get "failed attempt to launch program or document, action <http.......> params:<> the system cannot find the file specified and a pointer to line Run,%browser% %address% and I have checked the registry entry it is correct it points to firefoxURL
The script does Run, firefox.exe. Maybe you have Firefox installed somewhere that Windows is not able to find it.
This is the part that tries to figure out what the default browser is on the system.

Code: Select all

RegRead, ProgID, HKEY_CURRENT_USER, Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice, Progid
Browser := "iexplore.exe"
if (ProgID = "ChromeHTML")
   Browser := "chrome.exe"
if (ProgID = "FirefoxURL")
   Browser := "firefox.exe"
if (ProgID = "AppXq0fevzme2pys62n3e0fbqa7peapykr8v")
   Browser := "microsoft-edge:"
You might change the line Browser := "firefox.exe" to include the entire path to firefox.exe.

FG

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: furqan and 70 guests