evk86 Posted January 8, 2008 Share Posted January 8, 2008 (edited) i havent checked to see if there was nething similar already posted but a while ago i had the google sidebar installed on my system but i really only liked the quick google search that would pop up if you hit ctrl twice so i decided to write something with a similar function. note: only works with firefox installed.expandcollapse popup#include<Misc.au3> Global $time = TimerInit() Global $active = False Global $main Global $dlyTime = 1000 Global $inputbox Global $enabled = True Global $trans = 170 $process = ProcessList("Googler.exe") If $process[0][0]>1 Then Exit HotKeySet("^{Down}","TransDown") HotKeySet("^{Up}","TransUp") Opt("TrayMenuMode",1) TraySetIcon(@ProgramFilesDir&"\Googler\google_icon.ico") $disable = TrayCreateItem("Disable") $exit = TrayCreateItem("Exit") while 1 $msg = TrayGetMsg() if $msg = $disable then If $enabled = True Then $enabled = False TraySetIcon(@ProgramFilesDir&"\Googler\google_icon_disabled.ico") TrayItemSetText($disable,"Enable") Else $enabled = True TraySetIcon(@ProgramFilesDir&"\Googler\google_icon.ico") TrayItemSetText($disable,"Disable") EndIf EndIf if $msg = $exit Then Exit EndIf If $enabled = True Then If $active = False Then If _ispressed("11") Then Do sleep(10) until Not _IsPressed("11") If TimerDiff($time)>$dlyTime then $time = TimerInit() Else OPEN() EndIf EndIf EndIf If $active = True Then $mouseinfo = GUIGetCursorInfo($main) If $mouseinfo[2] = 1 Then If GUICtrlRead($inputbox) = "Enter Search Criteria" Then GUICtrlSetData($inputbox,"") EndIf EndIf If _IsPressed("1B") and WinActive("Googler") Then CLOSE() EndIf If _IsPressed("0D") and WinActive("Googler") Then SEARCH() ElseIf _ispressed("11")Then Do sleep(10) until Not _IsPressed("11") If TimerDiff($time)>$dlyTime then $time = TimerInit() Else CLOSE() EndIf EndIf EndIf EndIf WEnd Func OPEN() $active = True $main = GUICreate("Googler",500,75,-1,-1,$WS_POPUPWINDOW) GUISetBkColor(0xFFFFFF) GUISetFont(30) $inputbox = GUICtrlCreateInput("Enter Search Criteria",10,10,480,55) guisetstate(@SW_SHOW) WinSetOnTop("Googler","",1) WinSetTrans("Googler","",$trans) sleep($dlyTime) EndFunc Func CLOSE() $active = False GUIDelete($main) sleep($dlyTime) EndFunc Func SEARCH() $searchstring = GUICtrlRead($inputbox) if $searchstring <> "Enter Search Criteria" Then $split = stringsplit($searchstring," ") $searchstring = $split[1] If $split[0]>1 Then For $i = 1 to $split[0]-1 if $split[$i+1] = "+" then $split[$i+1] = "%2B" EndIf $searchstring = $searchstring&"+"&$split[$i+1] $searchstring = StringReplace($searchstring,'"',"%22") Next EndIf If $split[0]=1 Then if StringRight($searchstring,4) = ".com" or StringRight($searchstring,4) = ".net" or StringRight($searchstring,4) = ".org" or StringRight($searchstring,4) = ".edu" or StringRight($searchstring,4) = ".gov" then $dotchecker = StringSplit($searchstring,".") If $dotchecker[0]=2 Then CLOSE() ShellExecute("http://"&$searchstring) Else CLOSE() If StringInStr($searchstring,"www.") <> 0 Then ShellExecute($searchstring) Else Msgbox(16,"Error",$searchstring&" is invalid") EndIf EndIf Else CLOSE() ShellExecute('http://www.google.com/search?hl=en&q='&$searchstring&'&btnG=Google+Search"') EndIf Else CLOSE() ShellExecute('http://www.google.com/search?hl=en&q='&$searchstring&'&btnG=Google+Search"') EndIf EndIf EndFunc Func TransDown() If $trans > 0 then $trans = $trans - 5 WinSetTrans("Googler","",$trans) EndIf EndFunc Func TransUp() If $trans < 255 then $trans = $trans + 5 WinSetTrans("Googler","",$trans) EndIf EndFuncedit: added ability to go directly to a webpage if .com is typed at the endedit2: changed Run commands to ShellExecute (Suggested by GEOSoft)edit3: added .gov .net .edu .org to go directly to webpage, also added ability to type http://www. or www. to go directly to the webpage too.edit4: searchbar wont close on esc or enter unless googler is the active window. ctrl twice still works.edit5: fix to search for one wordedit6: ability to use quotes to search for multiple word phrasesedit7: (im a lil obsessive) now if you click in the input box before you type anything, it will clear the input box so that you dont accidentally run a search with the default message in the input boxgoogle_icon.icogoogle_icon_disabled.ico Edited January 10, 2008 by evk86 Link to comment Share on other sites More sharing options...
GEOSoft Posted January 8, 2008 Share Posted January 8, 2008 i havent checked to see if there was nething similar already posted but a while ago i had the google sidebar installed on my system but i really only liked the quick google search that would pop up if you hit ctrl twice so i decided to write something with a similar function. note: only works with firefox installed. expandcollapse popup#include<Misc.au3> Global $time = TimerInit() Global $active = False Global $main Global $dlyTime = 1000 Global $inputbox Global $enabled = True Global $trans = 170 $process = ProcessList("Googler.exe") If $process[0][0]>1 Then Exit HotKeySet("^{Down}","TransDown") HotKeySet("^{Up}","TransUp") Opt("TrayMenuMode",1) TraySetIcon(@ProgramFilesDir&"\Googler\google_icon.ico") $disable = TrayCreateItem("Disable") $exit = TrayCreateItem("Exit") while 1 $msg = TrayGetMsg() if $msg = $disable then If $enabled = True Then $enabled = False TraySetIcon(@ProgramFilesDir&"\Googler\google_icon_disabled.ico") TrayItemSetText($disable,"Enable") Else $enabled = True TraySetIcon(@ProgramFilesDir&"\Googler\google_icon.ico") TrayItemSetText($disable,"Disable") EndIf EndIf if $msg = $exit Then Exit EndIf If $enabled = True Then If $active = False Then If _ispressed("11") Then Do sleep(10) until Not _IsPressed("11") If TimerDiff($time)>$dlyTime then $time = TimerInit() Else OPEN() EndIf EndIf EndIf If $active = True Then If _IsPressed("1B") Then CLOSE() EndIf If _IsPressed("0D") Then SEARCH() CLOSE() ElseIf _ispressed("11") Then Do sleep(10) until Not _IsPressed("11") If TimerDiff($time)>$dlyTime then $time = TimerInit() Else CLOSE() EndIf EndIf EndIf EndIf WEnd Func OPEN() $active = True $main = GUICreate("Googler",500,75,-1,-1,$WS_POPUPWINDOW) GUISetBkColor(0xFFFFFF) GUISetFont(30) $inputbox = GUICtrlCreateInput("Enter Search Criteria",10,10,480,55) guisetstate(@SW_SHOW) WinSetOnTop("Googler","",1) WinSetTrans("Googler","",$trans) sleep($dlyTime) EndFunc Func CLOSE() $active = False GUIDelete($main) sleep($dlyTime) EndFunc Func SEARCH() $searchstring = GUICtrlRead($inputbox) if $searchstring <> "Enter Search Criteria" Then $split = stringsplit($searchstring," ") $searchstring = $split[1] If $split[0]>1 Then For $i = 1 to $split[0]-1 if $split[$i+1] = "+" then $split[$i+1] = "%2B" EndIf $searchstring = $searchstring&"+"&$split[$i+1] Next EndIf If $split[0]=1 and StringRight($searchstring,4) = ".com" then Run(@ProgramFilesDir&'\Mozilla Firefox\firefox.exe '&$searchstring) Else Run(@ProgramFilesDir&'\Mozilla Firefox\firefox.exe "http://www.google.com/search?hl=en&q='&$searchstring&'&btnG=Google+Search"') EndIf EndIf EndFunc Func TransDown() If $trans > 0 then $trans = $trans - 5 WinSetTrans("Googler","",$trans) EndIf EndFunc Func TransUp() If $trans < 255 then $trans = $trans + 5 WinSetTrans("Googler","",$trans) EndIf EndFunc edit: added ability to go directly to a webpage if .com is typed at the endI have something similar as a standalone and another one built into Project Express (this one also searches MSDN and soon TechNet). To make it work in the other browsers Change your Run lines to ShellExecute("http://www.google.com/search?hl=en&q='&$searchstring&'&btnG=Google+Search"') George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
evk86 Posted January 9, 2008 Author Share Posted January 9, 2008 ah cool thanks Link to comment Share on other sites More sharing options...
gseller Posted January 9, 2008 Share Posted January 9, 2008 Sweet! 5 stars from me... Love it. I added the file installs and file delete to have the icons installed into the temp folder and then deleted when the program is terminated.. Love the layed back transparent look.. Thanks for sharing. If you want my additions posted let me know. They are pretty common... Link to comment Share on other sites More sharing options...
evk86 Posted January 9, 2008 Author Share Posted January 9, 2008 Sweet! 5 stars from me... Love it. I added the file installs and file delete to have the icons installed into the temp folder and then deleted when the program is terminated.. Love the layed back transparent look.. Thanks for sharing. If you want my additions posted let me know. They are pretty common...if u have the ico files already in your program files then why bother putting them into your temp folder? Link to comment Share on other sites More sharing options...
evk86 Posted January 9, 2008 Author Share Posted January 9, 2008 lots of edits... comments would be helpful and appreciated Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2008 Share Posted January 9, 2008 (edited) Looks even better now. One thing I just noticed though.When you check for the existence of a dot you are adding "http://www." to the front. That will fail on some sites. Mine for example will not accept the "www.". It just takes http://mysite.server.orgI'm not sure how you would work around this but there will be a way. Perhaps with Ping() or InetGet()? Just entering the search as mysite.server.org (without your dot check) opens a standard Google search where the site is pretty much guarenteed to be at or near the top of the list. Edited January 9, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
gseller Posted January 9, 2008 Share Posted January 9, 2008 (edited) if u have the ico files already in your program files then why bother putting them into your temp folder?I see what your saying, in my working environment I will use partial codes to add to or create my own compilation and store on a shared drive so a single file that folks can save to their desktop is cleaner for the purpose.(If they open a file and all the images pop out on the desktop or they have to copy files to a folder it will not be used due to the fact that they are 1. non technical and 2. they are a lazy bunch... LOL)edit:Not sure if the edit made thisw am was a correction @ Geosoft but works fine for me using www.anything.com or http://www.anything.com Edited January 9, 2008 by gesller Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2008 Share Posted January 9, 2008 edit:Not sure if the edit made thisw am was a correction @ Geosoft but works fine for me using www.anything.com or http://www.anything.comWhat I was saying is that my site (and many others) do not use www. in the address so adding it in automaticlly will fail with "site not found". George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
evk86 Posted January 9, 2008 Author Share Posted January 9, 2008 Looks even better now. One thing I just noticed though. When you check for the existence of a dot you are adding "http://www." to the front. That will fail on some sites. Mine for example will not accept the "www.". It just takes http://mysite.server.org I'm not sure how you would work around this but there will be a way. Perhaps with Ping() or InetGet()? Just entering the search as mysite.server.org (without your dot check) opens a standard Google search where the site is pretty much guarenteed to be at or near the top of the list. what if i were to turn this If $dotchecker[0]=2 Then CLOSE() ShellExecute("http://www."&$searchstring) Else into If $dotchecker[0]=2 Then CLOSE() ShellExecute("http://"&$searchstring) Else that way if the website doesnt work with www. then it wont be typed but if it does, you can still get there (at least with my preliminary testing) Link to comment Share on other sites More sharing options...
gseller Posted January 9, 2008 Share Posted January 9, 2008 What I was saying is that my site (and many others) do not use www. in the address so adding it in automaticlly will fail with "site not found".Oh, I gotcha now.. My site works with or without the www. but I like to use it cause the search engine criteria filters it and favors www. sites.. The sub domain sites that do not use it, I misread your post. Sorry... Link to comment Share on other sites More sharing options...
GEOSoft Posted January 9, 2008 Share Posted January 9, 2008 what if i were to turn this If $dotchecker[0]=2 Then CLOSE() ShellExecute("http://www."&$searchstring) Else into If $dotchecker[0]=2 Then CLOSE() ShellExecute("http://"&$searchstring) Else that way if the website doesnt work with www. then it wont be typed but if it does, you can still get there (at least with my preliminary testing)That will probably be fine. In fact I think that will work in all cases. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now