AutoHotkey Community

It is currently May 27th, 2012, 2:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Quick Google
PostPosted: October 25th, 2006, 11:57 pm 
Offline

Joined: October 19th, 2006, 8:22 pm
Posts: 32
Location: mo
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 October 26th, 2006, 9:46 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2006, 12:10 am 
Offline

Joined: April 26th, 2006, 4:10 am
Posts: 657
Location: New Mexico, USA
I do not have google desktop but I just wanted to say good idea for the FadeIn\Out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2006, 9:14 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
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.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2006, 9:48 pm 
Offline

Joined: October 19th, 2006, 8:22 pm
Posts: 32
Location: mo
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2006, 10:53 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
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. :cry:

Thanks for the fix. I do really like the functional simplicity of this script.

:!: Keep up the good work :!:

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject: A Similar Script
PostPosted: October 27th, 2006, 6:13 am 
Offline

Joined: August 25th, 2006, 7:58 am
Posts: 50
Location: Michigan, USA
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 31st, 2008, 6:12 am 
Offline

Joined: December 29th, 2007, 9:40 pm
Posts: 142
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...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 7th, 2008, 8:36 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 5:35 am 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
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?

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 8:54 am 
Offline

Joined: May 27th, 2007, 9:41 am
Posts: 4999
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 FAQ
TF : Text files & strings lib, TF Forum


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 3:03 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
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.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2009, 12:56 am 
Offline

Joined: November 17th, 2005, 10:14 pm
Posts: 196
Location: Leicester, UK
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:
Code:
"%Clipboard%"

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2011, 9:05 pm 
Offline

Joined: February 21st, 2011, 9:05 pm
Posts: 87
Heres an updated version of this script. The codes pretty sloppy but it looks and works better.

http://www.autohotkey.net/~octalmage/Quick%20Google.ahk

Also put this in the same directory.

http://www.autohotkey.net/~octalmage/back.png


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2011, 9:14 pm 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
Nice graphics, and smooth hotkey. Must say I prefer http://www.autohotkey.com/forum/viewtopic.php?t=68669 though.

The fadein is subtle and nice.

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 22nd, 2011, 9:23 pm 
Offline

Joined: February 21st, 2011, 9:05 pm
Posts: 87
Seems like a bias opinion. :p

Looks pretty cool though, I'll give it a try.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group