Page 1 of 1
How to open google and search automatically?
#1
Posted 07 April 2008 - 05:26 PM
Ok say I have a GUI that has an input box and a go button.
User put "sql tutorial" in the input box and press {ENTER} (or click the go button).
This far I know how to do.
But, how do I open IE (or user's default browser) and it automatically 'googles' "sql tutorial"
displaying the result for the user?
Thanks!
(I tried search but confused on what the keyword should be, found nothing useful so far).
User put "sql tutorial" in the input box and press {ENTER} (or click the go button).
This far I know how to do.
But, how do I open IE (or user's default browser) and it automatically 'googles' "sql tutorial"
displaying the result for the user?
Thanks!
(I tried search but confused on what the keyword should be, found nothing useful so far).
#2
Posted 07 April 2008 - 05:29 PM
Here's a quick example :
Hope it helped !
[ code='text' ] ( Popup )
#include <GUIConstants.au3> #Include <IE.au3> $a = InputBox("Google search","type what you want to search here :") Preview($a) Func Preview($Submit = "") $oIE = _IECreate ("http://www.google.com") $oForm = _IEFormGetObjByName ($oIE, "f") $oQuery = _IEFormElementGetObjByName ($oForm, "q") _IEFormElementSetValue ($oQuery, $Submit) _IEFormSubmit ($oForm) EndFunc
Hope it helped !
#3
Posted 07 April 2008 - 05:32 PM
Yes it works.
Thank you.
Edit:
How about maps.google.com
or what is this thing:
Edit:
Oh I got it, it's from the page source, <form and stuff
Thank you.
Edit:
How about maps.google.com
or what is this thing:
[ code='text' ] ( Popup )
$oForm = _IEFormGetObjByName ($oIE, "f") $oQuery = _IEFormElementGetObjByName ($oForm, "q")
Edit:
Oh I got it, it's from the page source, <form and stuff
[ code='text' ] ( Popup )
<form action="/search" name=f><table cellpadding=0 cellspacing=0><tr valign=top><td width=25%> </td><td align=center nowrap><input name=hl type=hidden value=en><input maxlength=2048 name=q size=55 title="Google Search" value="">
This post has been edited by sensalim: 07 April 2008 - 06:40 PM
#5
Posted 07 April 2008 - 05:41 PM
You could also go straight to the 1st results page instead of the homepage, but it's good to learn how to use forms via autoit.
[ autoIt ] ( Popup )
#Include <IE.au3> $a = InputBox("Google search","type what you want to search here :") GoogleSearch($a) Func GoogleSearch($strSearch) $strSearch = StringReplace($strSearch," ","+") $oIE = _IECreate ("http://www.google.com/search?hl=en&q=" & $strSearch) EndFunc
#7
Posted 07 April 2008 - 09:56 PM
Dang, Googles source is not very reader friendly. :P Try this instead in the meantime.
[ autoIt ] ( Popup )
#Include <IE.au3> $a = InputBox("Google search","type what you want to search here :") GoogleSearch($a) Func GoogleSearch($strSearch) $strSearch = StringReplace($strSearch," ","+") $oIE = _IECreate ("http://maps.google.com/?ie=UTF8&hl=en&q=" & $strSearch) EndFunc
This post has been edited by spudw2k: 07 April 2008 - 09:58 PM
Page 1 of 1

Sign In
Register
Help

MultiQuote