Just wanted to say I really like the sccript "look_up.ahk". I did modify it for my personal use but gave all credit to you.
Thanks for the script.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%\Assets ; Ensures a consistent starting directory.
#SingleInstance Force
SetTitleMatchMode 2
/*
@author : GorvGoyl
@script Name : Duck_Search.ahk / Look_Up.ahk
@script Version : 0.1.0
@homepage : https://github.com/GorvGoyl/Autohotkey-Scripts-Windows/blob/master/look_up.ahk
@creation Date : May 09, 2022
@modification Date : 07:01 AM "CST" 2022/08/14
I modified this script but all credit goes to GorvGoyl. It now
use's DuckDuckGo as the search engine and Firefox browser.
=================================================================
*/
; Run Script as Admin (Reload if not as Admin)
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
Menu, Tray, Icon, duckduckgo.ico
^d:: ; use ctrl + d <-- DuckDuckGo Search Using Highlighted Text in Browser and Do DuckDuckGo Search / Visit Site (if it's url)
MyClip := ClipboardAll
Clipboard = ; empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel ; ClipWait timed out.
{
return
}
if RegExMatch(Clipboard, "^[^ ].[^ ]$")
{
Run "C:\Program Files\mozilla firefox\firefox.exe" %Clipboard%
}
else
{
; Modify some characters that screw up the URL
; RFC 3986 section 2.2 Reserved Characters (January 2005): !*'();:@&=+$,/?#[]
StringReplace, Clipboard, Clipboard, rn, %A_Space%, All
StringReplace, Clipboard, Clipboard, #, %23, All StringReplace, Clipboard, Clipboard, &, %26, All
StringReplace, Clipboard, Clipboard, +, %2b, All StringReplace, Clipboard, Clipboard, ", %22, All
Run % "https://www.duckduckgo.com/?q=" . clipboard ; uriEncode(clipboard)"
}
Clipboard := MyClip
return
; Handy function.
; Copies the selected text to a variable while preserving the clipboard.
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^c
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
; Pastes text from a variable while preserving the clipboard.
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard = ; For better compatability
Sleep 20 ; with Clipboard History
Clipboard := MyText
Send ^v
Sleep 100
Clipboard := SavedClip
Return
}
Just wanted to say I really like the sccript "look_up.ahk". I did modify it for my personal use but gave all credit to you.
Thanks for the script.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%\Assets ; Ensures a consistent starting directory.
#SingleInstance Force
SetTitleMatchMode 2
/*
@author : GorvGoyl
@script Name : Duck_Search.ahk / Look_Up.ahk
@script Version : 0.1.0
@homepage : https://github.com/GorvGoyl/Autohotkey-Scripts-Windows/blob/master/look_up.ahk
@creation Date : May 09, 2022
@modification Date : 07:01 AM "CST" 2022/08/14
@description :
=================================================================
*/
; Run Script as Admin (Reload if not as Admin)
if not A_IsAdmin
{
Run *RunAs "%A_ScriptFullPath%" ; Requires v1.0.92.01+
ExitApp
}
Menu, Tray, Icon, duckduckgo.ico
^d:: ; use ctrl + d <-- DuckDuckGo Search Using Highlighted Text in Browser and Do DuckDuckGo Search / Visit Site (if it's url)
MyClip := ClipboardAll
Clipboard = ; empty the clipboard
Send, ^c
ClipWait, 2
if ErrorLevel ; ClipWait timed out.
{
return
}
if RegExMatch(Clipboard, "^[^ ].[^ ]$")
{
Run "C:\Program Files\mozilla firefox\firefox.exe" %Clipboard%
}
else
{
; Modify some characters that screw up the URL
; RFC 3986 section 2.2 Reserved Characters (January 2005): !*'();:@&=+$,/?#[]
StringReplace, Clipboard, Clipboard,
rn, %A_Space%, AllStringReplace, Clipboard, Clipboard, #,
%23, All StringReplace, Clipboard, Clipboard, &,%26, AllStringReplace, Clipboard, Clipboard, +,
%2b, All StringReplace, Clipboard, Clipboard, ",%22, AllRun % "https://www.duckduckgo.com/?q=" . clipboard ; uriEncode(clipboard)"
}
Clipboard := MyClip
return
; Handy function.
; Copies the selected text to a variable while preserving the clipboard.
GetText(ByRef MyText = "")
{
SavedClip := ClipboardAll
Clipboard =
Send ^c
ClipWait 0.5
If ERRORLEVEL
{
Clipboard := SavedClip
MyText =
Return
}
MyText := Clipboard
Clipboard := SavedClip
Return MyText
}
; Pastes text from a variable while preserving the clipboard.
PutText(MyText)
{
SavedClip := ClipboardAll
Clipboard = ; For better compatability
Sleep 20 ; with Clipboard History
Clipboard := MyText
Send ^v
Sleep 100
Clipboard := SavedClip
Return
}