sensalim Posted April 7, 2008 Share Posted April 7, 2008 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). Link to comment Share on other sites More sharing options...
LIMITER Posted April 7, 2008 Share Posted April 7, 2008 Here's a quick example : #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 ! Link to comment Share on other sites More sharing options...
sensalim Posted April 7, 2008 Author Share Posted April 7, 2008 (edited) Yes it works. Thank you. Edit: How about maps.google.com or what is this thing: $oForm = _IEFormGetObjByName ($oIE, "f") $oQuery = _IEFormElementGetObjByName ($oForm, "q") Edit: Oh I got it, it's from the page source, <form and stuff <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=""> Edited April 7, 2008 by sensalim Link to comment Share on other sites More sharing options...
LIMITER Posted April 7, 2008 Share Posted April 7, 2008 With pleasure ! Link to comment Share on other sites More sharing options...
spudw2k Posted April 7, 2008 Share Posted April 7, 2008 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. #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 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
sensalim Posted April 7, 2008 Author Share Posted April 7, 2008 (edited) Crap, it doesn't work with maps.google.com ... hint? Edit: It works with spudw2k's way, though. Edited April 7, 2008 by sensalim Link to comment Share on other sites More sharing options...
spudw2k Posted April 7, 2008 Share Posted April 7, 2008 (edited) Dang, Googles source is not very reader friendly. Try this instead in the meantime. #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 Edited April 7, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF 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