 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
thinkstorm
Joined: 17 Aug 2004 Posts: 18
|
Posted: Tue Aug 17, 2004 7:21 pm Post subject: Google The Clipboard Content |
|
|
Copy a text snippet into the clipboard and google with Control-G
TC
| Code: | #g::
googleLinkStart = C:\PROGRA~1\INTERN~1\IEXPLORE.EXE http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=
AutoTrim, On
searchTerm = %clipboard%
if searchTerm =
{
MsgBox, 48, Search Google, No text in clipboard to google., 2
return
}
StringReplace, searchTerm, searchTerm, `r`n, +, all
StringReplace, searchTerm, searchTerm, %A_SPACE%, +, all
searchTerm = %googleLinkStart%%searchTerm%
Run, %searchTerm%
Return |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
|
| Back to top |
|
 |
thinkstorm
Joined: 17 Aug 2004 Posts: 18
|
Posted: Tue Aug 17, 2004 7:34 pm Post subject: |
|
|
I would not do that! if you already have an internet explorer open (if you use IE ;)), the script will use that window. adding the path to the program opens definitely a new window.
It's a pain to have the 8.3 path in here, though, fiddled around a little bit and couldn't figure out how to put a path with spaces up here (and adding a parameter)
TC |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Tue Aug 17, 2004 7:51 pm Post subject: |
|
|
| Quote: | | It's a pain to have the 8.3 path in here, though, fiddled around a little bit and couldn't figure out how to put a path with spaces up here (and adding a parameter) |
That's odd. I tried the following single-line script on XP and it worked okay:
Run %ProgramFiles%\Internet Explorer\IEXPLORE.EXE www.google.com
If you're using some other OS, maybe there's an OS-specific problem I should look into. |
|
| Back to top |
|
 |
thinkstorm
Joined: 17 Aug 2004 Posts: 18
|
Posted: Wed Aug 18, 2004 3:54 am Post subject: |
|
|
Hm,
you're absolutely right, it works like a blast! Maybe this was with an earlier version - the script is kind of old... Or I made another stupid mistkae, maybe I forgot the ',' after the RUN or something, anyway, the script works fine :)
TC |
|
| Back to top |
|
 |
porche911 Guest
|
Posted: Mon Aug 23, 2004 12:40 am Post subject: |
|
|
Here's a slightly modified version that will open a google search in a new tab in Mozilla Firefox, or else open a new broswer window.
#g::
clipboard =
Send, ^c
ClipWait, 1
if ErrorLevel <> 0
{
MsgBox, 48, Search Google, No text in clipboard to google., 2
return
}
googleLinkStart = http://www.google.com/search?hl=en&lr=UTF-8&q=
searchTerm = %clipboard%
AutoTrim, On
WinGetActiveTitle, Title
IfInString, Title, Mozilla Firefox
{
SetKeyDelay, 10
send ^t^l
send %googleLinkStart%%searchTerm%{Enter}
}
else
{
StringReplace, searchTerm, searchTerm, `r`n, +, all
StringReplace, searchTerm, searchTerm, %A_SPACE%, +, all
searchTerm = %googleLinkStart%%searchTerm%
Run, %searchTerm%
}
Return |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|