So basically you get this pop-up after you click a button to search if you click the change default browser button first
Code: Select all
#NoEnv
#Warn
SendMode Input
SetWorkingDir %A_ScriptDir%
; Hotkey to activate the search engine selection GUI (Win+Ctrl+Shift+W)
^+#W::
Send, ^c
Gui, Destroy
Sleep, 200 ; Wait for clipboard to capture the selected text
Gui, Add, Text, , Select a Search Engine:
Gui, Add, Button, x10 y30 w150 h30, Google
Gui, Add, Button, x170 y30 w150 h30, DuckDuckGo
Gui, Add, Button, x10 y70 w150 h30, Yandex
Gui, Add, Button, x170 y70 w150 h30, Bing
Gui, Add, Button, x10 y110 w150 h30, Yahoo
Gui, Add, Button, x170 y110 w150 h30, Swisscows
Gui, Add, Text, x10 y150, Select database:
Gui, Add, Button, x10 y170 w150 h30, UpToDate
Gui, Add, Button, x170 y170 w150 h30, DynaMed
Gui, Add, Button, x10 y210 w150 h30, Amboss
Gui, Add, Button, x170 y210 w150 h30, ClinicalKey
Gui, Add, Button, x10 y250 w150 h30, PubMed
Gui, Add, Button, x170 y250 w150 h30, ScienceDirect
Gui, Add, Button, x10 y310 w300 h30, ChangeDefaultBrowser
Gui, Add, Text, x10 y350, Search text: ; title
Gui, Add, Edit, x10 y370 w300 h30 vUserInput ; textbox
Gui, Show
Return
; Buttons to select the search engine
ButtonYahoo:
searchOrVisitFromClip("https://search.yahoo.com/search;_ylt=AwrNag_OGT5ljbgnQQdDDWVH;_ylc=X1MDMTE5NzgwNDg2NwRfcgMyBGZyAwRmcjIDcDpzLHY6c2ZwLG06c2ItdG9wBGdwcmlkA1V4T2ZWazdKUTJTZVkwZmYzZ0dYQUEEbl9yc2x0AzAEbl9zdWdnAzEwBG9yaWdpbgNzZWFyY2gueWFob28uY29tBHBvcwMwBHBxc3RyAwRwcXN0cmwDMARxc3RybAM0BHF1ZXJ5A3Rlc3QEdF9zdG1wAzE2OTg1Njg2NTY-?p=")
Gui, Destroy
Return
ButtonGoogle:
searchOrVisitFromClip("https://www.google.com/search?q=")
Gui, Destroy
Return
ButtonDuckDuckGo:
searchOrVisitFromClip("https://duckduckgo.com/?q=")
Gui, Destroy
Return
ButtonYandex:
searchOrVisitFromClip("https://www.yandex.com/search/?text=")
Gui, Destroy
Return
ButtonBing:
searchOrVisitFromClip("https://www.bing.com/search?q=")
Gui, Destroy
Return
ButtonUpToDate:
searchOrVisitFromClip("https://www-uptodate-com/contents/search?search=")
Gui, Destroy
Return
ButtonDynaMed:
searchOrVisitFromClip("https://www-dynamed-com/results?q=")
Gui, Destroy
Return
ButtonAmboss:
searchOrVisitFromClip("https://next.amboss.com/us/search?q=")
Gui,Destroy
Return
ButtonSwisscows:
searchOrVisitFromClip("https://swisscows.com/en/web?query=")
Gui,Destroy
Return
ButtonClinicalKey:
searchOrVisitFromClip("https://www-clinicalkey-com/#!/search/")
Gui, Destroy
Return
ButtonScienceDirect:
searchOrVisitFromClip("https://www-sciencedirect-com/search?pub=")
Gui, Destroy
Return
ButtonPubMed:
searchOrVisitFromClip("https://pubmed.ncbi.nlm.nih.gov/?term=")
Gui, Destroy
Return
searchOrVisitFromClip(searchUrl) {
GuiControlGet, UserInput, , UserInput ; Get the value from the UserInput GUI control
;check if textbox contains text
if (UserInput != "") {
Clipboard := UserInput
run, % searchUrl clipboard
}
;check if textbox is empty
if (UserInput = "") {
if (clipboard ~= "^https?://") {
run, % clipboard
} else {
run, % searchUrl clipboard
}
}
}
;reference https://stackoverflow.com/questions/32354861/how-to-find-the-default-browser-via-the-registry-on-windows-10
; Set the default browser using the Windows AssocQueryString method
SetDefaultBrowser(browserName) {
RegRead, browserPath, HKLM, SOFTWARE\Classes\http\shell\open\command
RegWrite, REG_SZ, HKCU, Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice, ProgId, %browserName%
WinClose Settings
}
ButtonChangeDefaultBrowser:
SetDefaultBrowser("Brave")
TrayTip, Notification, Default browser pop-up will appear at search, 10
Return