 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
xXJa50nXx
Joined: 19 Oct 2006 Posts: 32 Location: mo
|
Posted: Wed Oct 25, 2006 10:57 pm Post subject: Quick Google |
|
|
Hey
Im new to ahk and this is my first time posting here.
I wrote this program because i really liked the google desktop search feature (the one when you press ctrl twice), but google desktop takes up to much ram. All you do is press RCtrl and a gui pops up and you type some thing to search or if it starts with www it will open it up. There are a couple of things i wish it xould do that it can. Like a double ctrl hot key, and set it so when you click of the gui it goes away.
Thanks to q335r49 for your Desktop Replacement. (i took alot of code from there)
Its not much, but it works.
I know there is better ways to do some of the stuff i did but i couldnt find them.
~Jason
| Code: | Gui, Color, 000000
gui,add,text,cRed,Quick Google
Gui, +LastFound +ToolWindow
WinSet, Transparent, 200
WinSet, Region, 5-5 W460 H60 R10-10
Gui, -Caption
Gui, Font, S22 Default Cblack, EuroseWide Heavy
Gui, Add, Edit, x10 y20 w450 h40
Gui, Add, Button, w0 h0 Default, &Open
;Gui, Show, yCenter xCenter W472 H70,Googlewin
GuiActive=0
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,E&xit,CleanUp
Menu,Tray,Default
Return
~RCTRL::
if GuiActive
GoSub, GuiEscape2
else
{
Gui, Show, yCenter xCenter W472 H70, Googlewin
GuiActive = 1
FadeIn(200, "Googlewin")
KeyWait, RCTRL
}
Return
ButtonOpen:
ControlGetText, search, Edit1,Googlewin
StringLeft, www, search, 3
if (www=="www")
{
run %search%
GoSub, GuiEscape2
}
else if (search=="")
{
}
else
{
google = http://www.google.com/search?q=%search%
run %google%
GoSub, GuiEscape2
}
FadeIn(GUI_TRANS, WinName)
{
transL := 0
Loop, 20
{
transL += GUI_TRANS//20
WinSet, Transparent, %transL%, %WinName%
Sleep, 10
GuiActive=0;
}
}
FadeOut(GUI_TRANS, WinName)
{
transL := GUI_TRANS
Loop, 20
{
transL -= GUI_TRANS//20
WinSet, Transparent, %transL%, %WinName%
Sleep, 10
}
}
Return
GuiEscape2:
GuiActive = 0
FadeOut(GUI_TRANS, "Googlewin")
ControlSetText, Edit1, ,Googlewin
Gui, Hide
Return
CleanUp:
ExitApp |
Last edited by xXJa50nXx on Thu Oct 26, 2006 8:46 pm; edited 2 times in total |
|
| Back to top |
|
 |
.AHK
Joined: 26 Apr 2006 Posts: 657 Location: New Mexico, USA
|
Posted: Wed Oct 25, 2006 11:10 pm Post subject: |
|
|
| I do not have google desktop but I just wanted to say good idea for the FadeIn\Out. |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
Posted: Thu Oct 26, 2006 8:14 pm Post subject: |
|
|
I have to Google a lot doing Research for my job and, up until now,
Look Up Selected Text Using a Popup Menu of Reference Tools
was my script of choice because it is not limited to just Google.
This script is attractive to me, though, because of the nice, yet simple,
GUI that eliminates the need to highlight/select what I'm searching for.
I have a problem, though.... I type really fast and often have to hit
Enter twice for double line feeds. I hit Enter twice before the script
is done chewing on the Enter/If GUI routine and get stuck with single
line feeds, leaving me to go back and make edits.
This won't stop me from using it at home, but I'm gonna have to
go back to the other script at work. _________________
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played." |
|
| Back to top |
|
 |
xXJa50nXx
Joined: 19 Oct 2006 Posts: 32 Location: mo
|
Posted: Thu Oct 26, 2006 8:48 pm Post subject: |
|
|
Im Glad you like it
I fixed that problem.
I didnt know a better way but i found one.
I updated the code up top.
Tell me if that works better
Thanks,
Jason |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
Posted: Thu Oct 26, 2006 9:53 pm Post subject: |
|
|
| xXJa50nXx wrote: | I updated the code up top.
Tell me if that works better. |
Much better, indeed.
This is something I would have eventually done myself (I tweak almost every script I use)
but I gotta tell ya... 5 kids and 60+ hours a week and I just don't have time for much
of anything any more.
Thanks for the fix. I do really like the functional simplicity of this script.
Keep up the good work  _________________
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played." |
|
| Back to top |
|
 |
NakariaSan
Joined: 25 Aug 2006 Posts: 50 Location: Michigan, USA
|
Posted: Fri Oct 27, 2006 5:13 am Post subject: A Similar Script |
|
|
I made a similar script. It's really quite simple, and certainly a COMPLETE ripoff of Google's Desktop's double-tap Ctrl search bar. But it's a little different than the one posted here, so I figure I'll share it.
EDIT: I've updated the code below with some minor updates, including a fix for Firefox so that if you type in several words to search for, each word isn't searched for in separate tabs.
| Code: | RegRead, OutputVar, HKEY_CLASSES_ROOT, http\shell\open\command
StringReplace, OutputVar, OutputVar,"
SplitPath, OutputVar,,OutDir,,OutNameNoExt, OutDrive
browser=%OutDir%\%OutNameNoExt%.exe
justClosed=0
#IfWinNotExist, SearchFriend ahk_class #32770
~Ctrl::
{
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < doubleClickTime and justClosed = 0)
{
justOpened=1
SetTimer, SetOnTop, 500
InputBox, searchQuery, SearchFriend, , , 400, 100
if ErrorLevel = 0
{
StringReplace, searchQuery, searchQuery, %A_Space%, +, All
IfInString, searchQuery, .
{
IfInString, searchQuery, +
Run, %browser% http://www.google.com/search?hl=en&q=%searchQuery%
else
Run, %browser% %searchQuery%
}
else
Run, %browser% http://www.google.com/search?hl=en&q=%searchQuery%
}
}
return
}
#IfWinExist, SearchFriend ahk_class #32770
~Ctrl::
{
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < doubleClickTime and justOpened = 0)
{
WinClose, SearchFriend ahk_class #32770
justClosed=1
SetTimer, TripleClickProtection, 500
}
return
}
SetOnTop:
WinSet, AlwaysOnTop, On, SearchFriend ahk_class #32770
justOpened=0
SetTimer SetOnTop, Off
return
TripleClickProtection:
justClosed=0
SetTimer TripleClickProtection, Off
return |
|
|
| Back to top |
|
 |
TodWulff
Joined: 29 Dec 2007 Posts: 139
|
Posted: Mon Mar 31, 2008 5:12 am Post subject: To further tweak the original |
|
|
At the request of zeelig, I have added to the script a bit, adding a DDL and allowing the user to select from several search engines.
I chose not to clear the search engine DDL so as to give the user the opportunity to search from the same engine if they have multiple things that they are searching for...
| Code: |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
#SingleInstance, force
SEPre1 := "http://www.google.com/search?q="
SEPost1 :=
SEPre2 := "http://search.yahoo.com/search?p="
SEPost2 := "&fr=yfp-t-501&Toggle=1&cop=mss&ei=UTF-8"
SEPre3 := "http://www.dogpile.com/dogpile/ws/results/Web/"
SEPost3 := "/1/417/TopNavigation/Relevance/iq=true/zoom=off/_iceUrlFlag=7?_IceUrl=true"
Gui, Color, 000000
Gui, add, text, cRed, Quick Search
Gui, +LastFound +ToolWindow
WinSet, Transparent, 200
WinSet, Region, 5-5 W460 H120 R10-10
Gui, -Caption
Gui, Font, S22 Default Cblack, EuroseWide Heavy
Gui, Add, Button, w0 h0 Default, &Open
Gui, Add, Edit, x10 y20 w450 h40 -WantReturn
Gui, add, ddl, vSrchEngDDL AltSubmit, Google||Yahoo|DogPile
;Gui, Show, yCenter xCenter W472 H70,Googlewin
GuiActive=0
Menu,Tray,NoStandard
Menu,Tray,DeleteAll
Menu,Tray,Add,E&xit,CleanUp
Menu,Tray,Default
Return
~RCTRL::
If GuiActive
Gosub, GuiEscape2
Else
{
Gui, Show, yCenter xCenter W472 H150, SearchWin
GuiActive = 1
FadeIn(200, "SearchWin")
KeyWait, RCtrl
}
Return
ButtonOpen:
ControlGetText, SearchPram, Edit1, SearchWin
; msgBox, % SearchPram
StringLeft, www, SearchPram, 3
If (www=="www")
{
Run % SearchPram
Gosub, GuiEscape2
}
Else If (SearchPram=="")
{
Gosub, GuiEscape2
}
Else
{
GuiControlGet, Srch_Eng_Sel,,SrchEngDDL
SearchEngURL := SEPre%Srch_Eng_Sel% . SearchPram . SEPost%Srch_Eng_Sel%
; msgbox, % SearchEngURL
Run % SearchEngURL
Gosub, GuiEscape2
}
FadeIn(Gui_TRANS, WinName)
{
transL := 0
Loop, 20
{
transL += Gui_TRANS//20
WinSet, Transparent, %transL%, %WinName%
Sleep, 10
GuiActive=0;
}
}
FadeOut(GUI_TRANS, WinName)
{
transL := Gui_TRANS
Loop, 20
{
transL -= Gui_TRANS//20
WinSet, Transparent, %transL%, %WinName%
Sleep, 10
}
}
Return
GuiEscape2:
GuiActive = 0
FadeOut(Gui_TRANS, "SearchWin")
ControlSetText, Edit1, ,SearchWin
Gui, Hide
Return
CleanUp:
ExitApp |
_________________ When replying, please feel free to address me as Tod. My AHK.net site... |
|
| Back to top |
|
 |
kwon Guest
|
Posted: Mon Jul 07, 2008 7:36 pm Post subject: |
|
|
Can someone help me do the following to this script:
1. Accept quotes in the search field. So you can do exact string searches
2. Open an AHK controlled ie window. Right now, this will open multiple browser instances. It would be great if someone could help me get this to open an AHK controlled window that stays open, unless closed by user, and populates with new info when another query is run. |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
Posted: Fri Nov 27, 2009 4:35 am Post subject: |
|
|
Bump
| kwon wrote: | Can someone help me do the following to this script:
1. Accept quotes in the search field so you can do exact string searches. |
Has this been resolved?
If so, how? _________________
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played." |
|
| Back to top |
|
 |
SoLong&Thx4AllTheFish
Joined: 27 May 2007 Posts: 4999
|
Posted: Fri Nov 27, 2009 7:54 am Post subject: |
|
|
Haven't looked at the script, but try do a stringreplace on " and replace it with %22 just like you have to "translate" other characters like & to make a search string work. _________________ AHK Wiki FAQ
TF : Text files & strings lib, TF Forum |
|
| Back to top |
|
 |
SoggyDog
Joined: 02 May 2006 Posts: 783 Location: Greeley, CO
|
Posted: Fri Nov 27, 2009 2:03 pm Post subject: |
|
|
| HugoV wrote: | | Haven't looked at the script, but try do a stringreplace on " and replace it with %22 just like you have to "translate" other characters like & to make a search string work. |
Fair enough;
It had gotten entirely too late for my brain to function last night. _________________
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played." |
|
| Back to top |
|
 |
MsgBox
Joined: 17 Nov 2005 Posts: 181 Location: Leicester, UK
|
Posted: Fri Nov 27, 2009 11:56 pm Post subject: |
|
|
| SoggyDog wrote: | Bump
kwon wrote:
Can someone help me do the following to this script:
1. Accept quotes in the search field so you can do exact string searches.
Has this been resolved?
If so, how? |
This is what I use:
You could put a tickbox on the gui or use a modifier key to toggle between the two.
Like you, I also use PhiLho's brilliant MenuReferenceTools script, though modified to use a listbox now. Actually I use two versions, one for searching and the other for launching a few apps. Here's my version of his search script:
| Code: | ;___________________________
; \____K - WebSearch_____/
; Send queries to your favourite internet search engines.
; How to use:
; 1: Highlight a word or phrase then run K - WebSearch and press the letter
; in the first column that coresponds with the engine you want to use.
; Google is the default engine so pressing enter does the same as pressing "G".
; 2: Run K - WebSearch, type your query in the edit box then click your choice
; of search engine.
#NoEnv
SendMode Input
#SingleInstance Force
SetBatchLines -1
ClipSaved := ClipboardAll
Clipboard =
Send ^c
ClipWait 2
Clipboard = %Clipboard%
progName = K - WebSearch
list =
(
G¦Google¦www.google.co.uk/search?hl=en&q=@@
D¦Google Define¦www.google.co.uk/search?q=define:@@
I¦Google Images¦http://images.google.co.uk/images?hl=en&q=@@
V¦Google Video¦http://video.google.co.uk/videosearch?q=@@
Y¦YouTube¦http://www.youtube.com/results?search_type=&search_query=@@
W¦Wikipedia¦http://en.wikipedia.org/w/wiki.phtml?search=@@
M¦MultMap¦http://www.multimap.com/maps/?hloc=GB|@@
¦Astalavista¦http://astalavista.box.sk/cgi-bin/robot?srch=@@&submit=+search+
S¦ShareVirus¦www.google.co.uk/search?hl=en&q=@@ site:www.sharevirus.com
R¦RapidShare¦http://rapidshare-search-engine.com/index-s_submit=Search&sformval=1&s_type=2&what=1&s=@@&start=0.html
H¦Hansard¦http://hansard.millbanksystems.com/search/@@?sort=date
Z¦Amazon Uk¦http://www.amazon.co.uk/exec/obidos/external-search/202-5747633-4837436?field-keywords=@@
E¦EBay Uk¦http://search.ebay.co.uk/search/search.dll?from=R40&satitle=@@
C¦Dictionary.com¦http://dictionary.reference.com/browse/@@
O¦Online Etymology Dictionary¦http://www.etymonline.com/index.php?search=@@&searchmode=none
¦Word Origins¦http://www.google.com/custom?num=20&domains=www.wordorigins.org&sitesearch=www.wordorigins.org&q=@@
A¦AutoHotKey-Google¦www.google.co.uk/search?q=@@&sitesearch=autohotkey.com&btnG=Search&domains=autohotkey.com
¦AutoHotkey Forum¦www.autohotkey.com/forum/search.php?search_keywords=@@&search_terms=any&search_author=&search_forum=-1&search_time=0&search_fields=all&search_cat=-1&sort_by=0&sort_dir=DESC&show_results=topics&return_chars=200
K¦AutoHotkey Manual - Online¦www.autohotkey.com/docs/commands/@@.htm
)
Gosub buildGui
Clipboard := ClipSaved
ClipSaved =
Return
buildGui:
Gui -Caption 0x800000
;Gui Margin, 2, 2
Gui Add, Button, x0 y0 w0 h0 Default ggetResult
Gui Font, s12, Comic Sans Ms
Gui Add, Button, x5 y5 w202 h30 Disabled, %progName%
Gui Font
Gui Add, Text, x5 y5 w200 h30 gguiDrag +BackgroundTrans ; Click and drag.
Gui Add, Edit, x6 yp+31 w200 vmySearch
Gui Add, ListView, x yp+23 w200 r14 -Hdr Grid AltSubmit vsEngine ggetResult, &|@ where to search ...|Address
Gosub fillLV
Gui Show, w211, %progName%
GuiControl,,Edit1, %Clipboard%
GuiControl Focus, sEngine
Return
getResult:
Gui Submit, NoHide
If (mySearch) ; Manual query via the edit box.
Clipboard = %mySearch% ; Send edit box contents to the clipboard.
If (A_GuiEvent = "Normal" || A_GuiEvent = "I" || A_GuiEvent = "K") {
lvNo := LV_GetNext(0, "Focused") ; Get row no. of selected entry.
LV_GetText(Choice, lvNo,3) ; Get info from column 3 of selected row.
If (Choice = "Address") ; No row selected ...
Choice = www.google.co.uk/search?hl=en&q=@@ ; so make Google the default.
IfInString Choice, google.co.uk ; Google "search query enclose in quotes"
{
q = \"%Clipboard%\" ; \ ensures query enclosed in "" is accepted by Google.
If Clipboard= ; If nothing selected...
q= ; query will be empty, Google front page will load.
Clipboard := q
}
StringReplace getResult, Choice, @@, %Clipboard%, All ; Add query to search url.
Run %getResult% ; Go get results.
ExitApp
}
Return
fillLV:
Loop Parse, list, `n
{
l := A_LoopField
If !l
l = ¦¦¦
StringSplit, r, l, ¦
LV_Add("", r1, r2, r3)
LV_ModifyCol(2, "145")
LV_ModifyCol(3, "0")
Cnt++
l=
}
Return
guiDrag:
PostMessage, 0xA1, 2,,, A
Return
GuiClose:
GuiEscape:
ExitApp |
|
|
| Back to top |
|
 |
octal
Joined: 21 Feb 2011 Posts: 70
|
|
| Back to top |
|
 |
sumon
Joined: 18 May 2010 Posts: 1016 Location: Sweden
|
|
| Back to top |
|
 |
octal
Joined: 21 Feb 2011 Posts: 70
|
Posted: Tue Feb 22, 2011 8:23 pm Post subject: |
|
|
Seems like a bias opinion. :p
Looks pretty cool though, I'll give it a try. |
|
| 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
|