在 URL 中用引号包围剪贴板

Surrounding Clipboard with quotes in URL

警告:我对此很陌生。

我想 Google 通过分配一个热键来搜索文本选择(在网络浏览器中)并用引号括起该搜索(以获得精确匹配)来加快搜索速度。

我已经尝试使用我找到的一些代码,但到目前为止我只能在 Google 上搜索选定的文本,但不知道如何在搜索中用引号将选定的文本括起来.

^!d:: ;

prevClipboard := ClipboardAll
SendInput, ^c  
ClipWait, 1 
if !(ErrorLevel)  { 
    Clipboard := RegExReplace(RegExReplace(Clipboard, "\r?\n"," "), "(^\s+|\s+$)")
    If SubStr(ClipBoard,1,7)="http://"
Run, % Clipboard
else 
Run, % "https://www.google.com/search?q=" Clipboard
} 
Clipboard := prevClipboard
return

这只是用剪贴板打开 google 搜索。 我不知道如何制作它,所以搜索 "Clipboard" 而不是剪贴板。

有什么建议吗?谢谢!

运行是命令,variables in commands必须用百分号括起来。

要包含引号,请指定两个连续的引号两次:

Run, http://www.google.com/search?q=""%Clipboard%""

如果你想从任何 Selected 文本(以及从你计算机系统上的任何地方)做一个 "Phase google search"

那你可以试试这个 AHK 脚本。

您可以 [Select 任何文本],然后您可以单击键盘设备上的 [F1] 键。

计算机查找自动找出它可以在哪里进行查询搜索(我们 100 倍的结果)以及它必须使用什么浏览器。

Example1.ahk

;#notrayicon
#SingleInstance force

GroupAdd, Browser, ahk_class Chrome_WidgetWin_1 ; Chrome or Iron
GroupAdd, Browser, ahk_class IEFrame            ; Internet Explorer
GroupAdd, Browser, ahk_class MozillaWindowClass ; FireFox
GroupAdd, Browser, ahk_class ApplicationFrameWindow ; Edge

; here you can change the variable into exact search [
quote1 = "
; here you can change the variable into exact search ]
quote2 = "

; here you can change the variables intitle: - inurl: - inanchor: - allinurl: - allinanchor:
insearch = allintitle:

; + = Shift
; ! = Alt
; ^ = Ctrl
; # = Win (Windows logo key)

esc::exitapp ;You can click the (esc) key to stop the script.

f1::
If WinActive("ahk_group Browser")
{
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
sendinput ^t ;CTRL+t make a new tab + goto address bar - use CTRL+L for the active tab + goto address bar
sleep 150
texta = https://www.google.com/?gfe_rd=cr&gws_rd=cr#q=%insearch%%quote1%
textb = %clipboard%%quote2% ;selected text
textc = &lr=lang_us&hl=us&num=100 ; google parameters

clipboard=%texta%%textb%%textc%
sleep 150
sendinput ^v ; paste the selected text 
sleep 250
send {enter}
clipboard=%textb%
} else {
sendinput ^c ;copy the selected text to clipboard memory
sleep 150
texta = https://www.google.com/?gfe_rd=cr&gws_rd=cr#q=%insearch%%quote1%%quote1%
textb = %clipboard%%quote2%%quote2%%quote2% ;selected text
textc = &lr=lang_us&hl=us&num=100 ; google parameters

clipboard=%texta%%textb%%textc%
run %clipboard%
clipboard=%textb%
}

return