Ich habe mir die Google 'Auf gut Glück' Funktion angeguckt und habe es selber für Bing und Google erstellt, so kam ich dann auf die Idee etwas größeres auf die Art und Weise zu erstellen.
Und hier ist es, ein Programm das Informationen zur Stadt, News, Bilder und so ein kram anzeigt.
Screenshot: autoit.de/wcf/attachment/8464/
Programm:
Spoiler anzeigen
#NoTrayIcon
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=city-icon.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Inet.au3>
#include <chatbox.au3>
#include <StaticConstants.au3>
global $winx=633
global $winy=357
global $title="Stadtanzeiger V1.0 by TheShadowAE"
global $gefunden=0
global $imgfile=""
global $city=""
Opt("GUIOnEventMode",1)
Global $gui
#Region ### START Koda GUI section ### Form=d:\progen\autoit\meine\forms\stadtanzeiger.kxf
$gui = GUICreate($title, $winx, $winy, 192, 124)
GUISetIcon("city-icon.ico")
$Label1 = GUICtrlCreateLabel("Suchbegriff:", 8, 8, 70, 17)
$Input1 = GUICtrlCreateInput("Stadt/Postleitzahl", 104, 8, 129, 21)
$Button1 = GUICtrlCreateButton("Suchen", 248, 8, 89, 25, $WS_GROUP)
$Label2 = createlinklabel("Stadtseite", 24, 56, 212, 17)
$Label3 = createlinklabel("Linkseite", 24, 80, 212, 17)
$Pic1 = GUICtrlCreatePic("", 24, 120, 241, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label4 = GUICtrlCreateLabel("News:", 288, 48, 52, 17)
$chatbox = _chatbox_create($gui, 288, 72, 321, 193)
$Label5 = createlinklabel("Newsseite", 288, 280, 324, 17)
$Label6 = createlinklabel("Mapseite", 288, 304, 324, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GUISetOnEvent($GUI_EVENT_CLOSE,"ende")
GUICtrlSetOnEvent($Button1,"suchen")
GUICtrlSetOnEvent($Label2,"link2")
GUICtrlSetOnEvent($Label3,"link3")
GUICtrlSetOnEvent($Label5,"link5")
GUICtrlSetOnEvent($Label6,"link6")
GUICtrlSetState($Input1, $GUI_FOCUS)
GUICtrlSetState($Button1, $GUI_DEFBUTTON)
while 1
if WinActive($gui)=0 Then WinWaitActive($gui)
if _IsPressed("1B") Then ExitLoop
Sleep(10)
WEnd
Exit
func suchen()
;Prüfen
$txt=GUICtrlRead($Input1)
if $txt="Stadt/Postleitzahl" Then
GUICtrlSetData($Input1,"")
Return
EndIf
If $txt="" Then Return
$eingabe=""
if int($txt)=0 Then $eingabe="Stadt"
If Int($txt)>0 Then $eingabe="Zahl"
;Ausblenden
AdlibRegister("load",200)
WinSetTrans($gui,"",175)
GUISetState(@SW_DISABLE)
;Arbeiten
if $eingabe="Stadt" Then
GUICtrlSetData($Label2,"http://"&$txt&".de")
$city=$txt
Else
stadtname($txt)
EndIf
agglink($txt)
image($txt)
GUICtrlSetData($Label6,"http://maps.google.de/maps?q="&$txt&"&oe=utf-8&rls=org.mozilla:de:official&client=firefox-a&um=1&ie=UTF-8&sa=N&hl=de&tab=wl")
GUICtrlSetData($Label5,"http://news.google.de/news?q="&$txt&"&oe=utf-8&rls=org.mozilla:de:official&client=firefox-a&um=1&ie=UTF-8&hl=de&sa=N&tab=ln")
news($city)
;Anzeigen
GUISetState(@SW_ENABLE)
AdlibUnRegister("load")
WinSetTitle($gui,"",$title)
WinSetTrans($gui,"",255)
$gefunden=1
GUICtrlSetState($Input1, $GUI_FOCUS)
GUICtrlSetState($Button1, $GUI_DEFBUTTON)
EndFunc
Func image($txt)
FileDelete($imgfile)
$begriff=$city;$txt
if $city="" Then $begriff=$txt
$code=_INetGetSource("http://images.google.de/images?um=1&hl=de&client=firefox-a&rls=org.mozilla%3Ade%3Aofficial&tbs=isch%3A1&sa=1&q="&$begriff&"&aq=f&aqi=g10&aql=&oq=&gs_rfai=&start=0")
$suche='<a href=/imgres?imgurl='
$to='&'
$a=StringInStr($code,$suche,0,1)+StringLen($suche)
$b=StringInStr($code,$to,0,1,$a)
$url=StringMid($code,$a,$b-$a)
$tmp=StringSplit($url,"/")
$dat=$tmp[UBound($tmp)-1]
$dat=@TempDir&"\"&$dat
$inet=InetGet($url,$dat,0,1)
While not InetGetInfo($inet,2)
Sleep(10)
WEnd
InetClose($inet)
GUICtrlSetImage($Pic1,$dat)
$imgfile=$dat
EndFunc
Func stadtname($txt)
$source=_INetGetSource("http://www.postleitzahl.org/suche.html?type=plz&string="&$txt&"&submit=Finde!")
$suche='<table cellspacing="3" cellpadding="1" border="0" width="100%">'&@crlf&' <tr>'&@CRLF&' <td valign="top"><b><a href="/'
$a=StringInStr($source,$suche,1,1)+StringLen($suche)
$b=StringInStr($source,'">',1,1,$a)
$str=StringMid($source,$a,$b-$a)
$a=StringInStr($str,"/",0,1)+1
$b=StringInStr($str,"/",0,1,$a)
$stadt=StringMid($str,$a,$b-$a)
$stadt=inettostring($stadt)
if StringInStr($stadt,"PLZ Deutschland") Then
GUICtrlSetData($Label2,"")
Return
EndIf
$city=$stadt
GUICtrlSetData($Label2,"http://"&$stadt&".de")
EndFunc
Func agglink($txt)
$suche=_INetGetSource("http://www.google.de/search?hl=de&q="&$txt&"&meta=&aq=f&aqi=g9g-s1&aql=&oq=&gs_rfai=")
$search='<li class=g><h3 class=r><a href="'
$ab=StringInStr($suche,$search,1,1)+StringLen($search)
$bc=StringInStr($suche,'"',1,1,$ab)
GUICtrlSetData($Label3,StringMid($suche,$ab,$bc-$ab))
EndFunc
Func link2()
If $gefunden=1 Then openlink(GUICtrlRead($Label2))
EndFunc
Func link3()
If $gefunden=1 Then openlink(GUICtrlRead($Label3))
EndFunc
Func link5()
If $gefunden=1 Then openlink(GUICtrlRead($Label5))
EndFunc
Func link6()
If $gefunden=1 Then openlink(GUICtrlRead($Label6))
EndFunc
func createlinklabel($text,$left,$top,$width=50,$height=15,$style=0,$exstyle=0)
local $label=GUICtrlCreateLabel($text,$left,$top,$width,$height,$style,$exstyle)
GUICtrlSetFont($label,8.5,400,4,"Arial")
GUICtrlSetColor($label,0x0000FF)
GUICtrlSetCursor($label,14);16) ;16 funktioniert nicht..
Return $label
EndFunc
Func openlink($link)
ShellExecute($link)
EndFunc
func ende()
GUIDelete()
FileDelete($imgfile)
Exit
EndFunc
Func load()
$tit=WinGetTitle($gui)
If StringRight($tit,1)="." Then $punkte=".."
If StringRight($tit,2)=".." Then $punkte="..."
if StringRight($tit,3)="..." Then $punkte=""
If StringRight($tit,1)<>"." Then $punkte="."
WinSetTitle($gui,"",$title&" - Laden"&$punkte)
EndFunc
Func inettostring($wort)
;~ $wort=StringReplace($wort,"%C3%BC","ü")
$wort=StringReplace($wort,"%F6","ö")
;~ $wort=StringReplace($wort,"%C3%A4","ä")
;~ $wort=StringReplace($wort,"%C3%96","Ö")
;~ $wort=StringReplace($wort, "%C3%9","Ü")
;~ $wort=StringReplace($wort,"%C3%84","Ä")
;~ $wort=StringReplace($wort, "%21","!")
Return $wort
EndFunc
Func news($begriff)
$source=_INetGetSource("http://news.google.de/news?q="&$begriff&"&oe=utf-8&rls=org.mozilla:de:official&client=firefox-a&um=1&ie=UTF-8&hl=de&sa=N&tab=ln")
$suche='headline-story thumbnail-false "> '
$a=StringInStr($source,$suche,1,1)+StringLen($suche)
$d=StringInStr($source,'<b>...</b>',1,1,$a)+10
$c=StringInStr($source,'<b>...</b>',1,1,$d)+10
$b=StringInStr($source,'<b>...</b>',1,1,$c)+10
$str=StringMid($source,$a,$b-$a)
$str=StringReplace($str,"<b>...</b>","<b>...</b>"&@CRLF)
$str=StringReplace($str,"ö","ö")
$str=StringReplace($str,"ü","ü")
$str=StringReplace($str,"ä","ä")
$str=StringReplace($str,"</a>","</a>"&@CRLF)
$str=StringReplace($str,"</span></div>","</span></div>"&@CRLF)
$str=StringReplace($str,"– ","- ")
_chatbox_clean($chatbox)
if StringLen($str)>10000 Then
Return
Else
_chatbox_setdata($chatbox,$str)
EndIf
EndFunc
Func _chatbox_clean(byref $ahChat,$iBgColor=0xFFFFFF)
If Not IsArray($ahChat) Then Return SetError(1, 0, 0)
If UBound($ahChat) <> 5 Then Return SetError(2, 0, 0)
$ahChat[2] = '<html>' & @CRLF & '<head>' & @CRLF & '<title>Chatbox</title>' & @CRLF & '<style type="text/css">body { background-color:#' & Hex($iBgColor, 6)
$ahChat[2] &= '; padding:0px; margin:4px; } p { margin:4px; }</style>' & @CRLF & '</head>' & @CRLF & '<body>' & @CRLF & '</body>' & @CRLF & '</html>'
$sTempFile = @TempDir & '\ChatboxTemp.html'
$hFile = FileOpen($sTempFile, 2)
FileWrite($hFile, $ahChat[2])
FileClose($hFile)
_IENavigate($ahChat[0], $sTempFile)
Return 1
EndFunc
Download: