Google, Dictionary, Thesaurus Search

Post your working scripts, libraries and tools
FanaticGuru
Posts: 659
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] [Expand] [Download] (Google.ahk)GeSHi © Codebox Plus


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] [Expand] [Download] (Dictionary.ahk)GeSHi © Codebox Plus


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] [Expand] [Download] (Thesaurus.ahk)GeSHi © Codebox Plus


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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
User avatar
Iomega0318
Posts: 83
Joined: 06 Apr 2015, 14:56
Facebook: jonimpson
Google: jonimpson
GitHub: Iomega0318
Location: Wolfforth, TX
Contact:

Re: Google and Dictionary Search

08 May 2015, 15:08

This looks interesting :)
FanaticGuru
Posts: 659
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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
User avatar
AlleyArtwork
Posts: 23
Joined: 09 Jun 2015, 21:08

Re: Google and Dictionary Search

11 Jun 2015, 20:26

This dictionary search is fantastic!
loop {
MsgBox, Life is like an Infinite Message Box of chocolates.`nThere are %a_index% chocolates in this box.
}
rommmcek
Posts: 233
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!
FanaticGuru
Posts: 659
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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
rommmcek
Posts: 233
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!
rommmcek
Posts: 233
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!
FanaticGuru
Posts: 659
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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
rommmcek
Posts: 233
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!
rommmcek
Posts: 233
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 87 times
Last edited by rommmcek on 16 Mar 2016, 16:48, edited 1 time in total.
rommmcek
Posts: 233
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] [Download] GeSHi © Codebox Plus

  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] [Download] GeSHi © Codebox Plus

stringreplace, Http_Text, Http_Text, `r,, all
FanaticGuru
Posts: 659
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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
rommmcek
Posts: 233
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!
FanaticGuru
Posts: 659
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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
rommmcek
Posts: 233
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: 12
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
FanaticGuru
Posts: 659
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] [Download] (Untitled.ahk)GeSHi © Codebox Plus

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

Google Search, Dictionary, Thesaurus - Quickly Get Information from Specific Web Resources

[Function] Timer - Create and Manage Timers
becritical
Posts: 12
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] [Download] (Untitled.ahk)GeSHi © Codebox Plus

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”

Who is online

Users browsing this forum: kczx3 and 18 guests