Google, Dictionary, Thesaurus Search

Post your working scripts, libraries and tools for AHK v1.1 and older
becritical
Posts: 15
Joined: 23 May 2016, 03:28

Re: Google, Dictionary, Thesaurus Search

01 Feb 2017, 10:26

okay I got past that error, I was having a problem with the Run command because I had to change to U64.

now I have another issue, I get an error at the Run, %browser% %Address% line. "The system cannot find the file specified"
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Google, Dictionary, Thesaurus Search

01 Feb 2017, 16:55

becritical wrote: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"
In order to debug I would start simple and try just running this code to see if an AHK script can start Firefox on your system:

Code: Select all

Run, 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
BannerStore
Posts: 87
Joined: 06 Sep 2017, 19:29

Re: Google, Dictionary, Thesaurus Search

12 May 2020, 16:23

Fantastic Guru,

Unfortunately, I tried your Google, Dictionary and Thesaurus Search scripts and they don't seem to work. Maybe I'm doing something wrong.

Also, I was wondering why would it be better to have the searches appear in a dialog box instead of a webpage? If it appears in a webpage, you can click synonyms of the synonyms or the defnition of a word you don't understand within a definition.

These are the Google, Dictionary and Thesaurus Search Scripts that I use if anyone wants to use them.

Code: Select all

;                            **********************************************************
;                            *       	   Google Search of Selected Text             *
;                            **********************************************************

+^a:: 																		; Hotkey  ==>  Control + Shift + a
OldClipboard:= ClipboardAll														
Clipboard:= ""																	
Send, ^c
ClipWait 0
If ErrorLevel
{
	MsgBox, 16, Warning, No Text Was Selected!, 2
	Return
}
Sleep 50
Run "https://www.google.com/search?q=%clipboard%"
Clipboard:= OldClipboard
Return



;                            **********************************************************
;                            *      Look Up Defintion via Macmillan Dictionary        *
;                            **********************************************************

+^d:: 																	
OldClipboard:= ClipboardAll													; Put Clipboard contents temporarily into variable, OldClipboard
Clipboard:= ""																; Empties Clipboard
Send, ^c 																	; Copies selected text
ClipWait 0																
If ErrorLevel																; If nothing was selected, an error dialog appears.
{
	MsgBox, 16, Warning, No Text Was Selected!, 2
	Return
}
Run, https://www.macmillandictionary.com/search/american/direct/?q=%clipboard%
Sleep 200	
Clipboard:= OldClipboard
Return


;                            **********************************************************
;                            *          Look Up Synonyms via Thesaurus.com             *
;                            **********************************************************

+^s:: 																		
OldClipboard:= ClipboardAll
Clipboard:= ""
Send, ^c ;copies selected text
ClipWait 0
If ErrorLevel
{
	MsgBox, 16, Warning, No Text Was Selected!, 2
	Return
}
Run https://www.thesaurus.com/browse/%Clipboard%
Clipboard:= OldClipboard
Return
User avatar
FanaticGuru
Posts: 1906
Joined: 30 Sep 2013, 22:25

Re: Google, Dictionary, Thesaurus Search

21 May 2020, 17:41

BannerStore wrote:
12 May 2020, 16:23
Fantastic Guru,

Unfortunately, I tried your Google, Dictionary and Thesaurus Search scripts and they don't seem to work. Maybe I'm doing something wrong.

Also, I was wondering why would it be better to have the searches appear in a dialog box instead of a webpage? If it appears in a webpage, you can click synonyms of the synonyms or the defnition of a word you don't understand within a definition.

This script use to create a really cool light-weight GUI that did allow you to click on synonyms to then look up those words with other nice features but alas Dictionary.com changed their webpage format and purposely made it difficult to scrap the information from their site which broke this script.

I looked at getting it to work again and I probably could but they clearly added random and dynamic elements within the html code of their webpage to foil accessing the information outside a traditional web browser that displays their advertising. I figured it would end up being a game of cat and mouse to keep the script working like it originally did and gave up.

I really liked the script though so maybe one day I will look at getting it to work with a different site.

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
BannerStore
Posts: 87
Joined: 06 Sep 2017, 19:29

Re: Google, Dictionary, Thesaurus Search

26 May 2020, 19:29

FantasticGuru,

I just checked the script and everything still works. Maybe your autoexecute section is different than mine. Here is mine:

Code: Select all

;
;
;				         	       			MY HOTKEYS
;   				  				   (Supplements PhraseExpress)
;
;                                               AUTOEXECUTE SECTION
;==================================================================================================================
#NoTrayIcon         		; Removes this script's AutoHotkey icon in the notification area. It's unnecessary.
#Persistent				; Ensures this script will always be running in the background.  Never stops.
#SingleInstance force  		; Only one instance of this script will be allowed to run at a time.
SetWorkingDir %A_ScriptDir%  	; Ensures a consistent starting directory.
SendMode Input  			; Send (aka SendEvent) changed to SendInput which is a faster and more reliable command.
SetBatchLines,-1			; Run script at maximum speed.
Return

;Legend:            	+	=	shift
;					^	=	control
;					! 	= 	alt
;					#	=	windows key
User avatar
rommmcek
Posts: 1473
Joined: 15 Aug 2014, 15:18

Re: Google, Dictionary, Thesaurus Search

02 Jun 2020, 17:10

BannerStore wrote:
12 May 2020, 16:23
Fantastic Guru
What a fantastic spoonerism!

@FanaticGuru: My method never stopped working. O.k. I had to adapt reference names, but that we expected anyway.
I thought you don't update because of GDPR. I'm still not sure about it, so I post only the function and its up to user what to do with it! Even if I'm lately more orientated towards Google translator, I still use this app occasionally and am very thankful to you for showing how to: Loop through elements, RegExMatch/Replace, Array for history etc..! It's a bit developed, but there's sill room for improvements!
See pics, what can be done with it.
Function w/ Exemples
Attachments
Dicti-Thesa 2.png
Dicti-Thesa 2.png (140.33 KiB) Viewed 1256 times

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: NPerovic, songdg and 48 guests