Hallo,bin dabei,bestimmte Wetterdaten von Freemeteo zu beziehen,und da ich dort pro auszulesenden Tag mehrmals rumklicken müßte,dachte ich Autoit macht das schon.Soweit,so gut.Mein Array,in dem die Wetterdaten pro Tag eingelesen werden,steht.Dabei habe ich mitbekommen,daß dieses verflixte "ö" mit "ö",z.b." bewölkt" dargestellt wird.das wollt ich jetzt rausformatieren.Erst mal das Script:
Spoiler anzeigen
#include <FF.au3>
#include <String.au3>
#include <Array.au3>
#include <ArrayMore.au3>
#include <Date.au3>
#include <ButtonConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
#include <GuiListView.au3>
#include <ComboConstants.au3>
#include <html.au3>
#include <INet.au3>
HotKeySet("{ESC}", "ende")
Opt("GUIOnEventMode", 1)
$click = 0
Global $DAYSTRING[1], $url
#Region ### START Koda GUI section ### Form=
$DatumGUI = GUICreate("Datum erhalten", 357, 193, 310, 170, $WS_POPUP + $WS_BORDER, $WS_EX_TOOLWINDOW)
GUISetFont(14)
$Label1 = GUICtrlCreateLabel("", 0, 0, 92, 36, BitOR($SS_CENTER, $WS_BORDER))
GUICtrlSetBkColor(-1, 0xffffff)
$Label2 = GUICtrlCreateLabel("", 265, 0, 92, 36, BitOR($SS_CENTER, $WS_BORDER))
GUICtrlSetBkColor(-1, 0xffffff)
$StartButton = GUICtrlCreateButton("Start", 265, 149, 92, 41, $WS_GROUP)
$MonthCal1START = GUICtrlCreateMonthCal("2011/02/07", 93, 0, 170, 161)
GUICtrlSetFont(-1, ![]()
$ort = GUICtrlCreateInput("Dresden", 92, 165, 172, 27, BitOR($SS_CENTER, $WS_BORDER))
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent($StartButton, "labeling")
GUICtrlSetOnEvent($MonthCal1START, "labeling")
GUICtrlSetOnEvent($ort, "labeling")
#EndRegion ### END Koda GUI section ###
#Region ### START Koda GUI section ### Form=
$ORTLISTE = GUICreate("", 417, 60, 192, 124, $WS_POPUP + $WS_BORDER, $WS_EX_TOOLWINDOW)
$ListView1 = GUICtrlCreateListView("|||||", 0, 0, 417, 60)
GUICtrlSendMsg($ListView1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES)
GUISetState(@SW_HIDE)
#EndRegion ### END Koda GUI section ###
Func los()
$html = "http://freemeteo.com/default.asp?pid=15&la=3&cn=DE"
_FFStart($html, "default", 1, True)
If _FFLoadWait() Then _FFSetValueById("search-city", GUICtrlRead($ort))
_FFclick("search-submit", "name")
If _FFLoadWait() Then
$results = _FFTableWriteToArray(1, "index", "text", True)
Dim $results1[UBound($results, 1)][5]
For $a = 0 To UBound($results, 1) - 1
$results1[$a][0] = $results[$a][0]
$results1[$a][1] = $results[$a][1]
$results1[$a][2] = $results[$a][2]
$results1[$a][3] = $results[$a][5]
$results1[$a][4] = $results[$a][6]
Next
GUISetState(@SW_SHOW, $ORTLISTE)
GUICtrlSetData($ListView1, $results1[1][0] & "|" & $results1[1][1] & "|" & $results1[1][2] & "|" & $results1[1][3] & "|" & $results1[1][4])
Dim $listitems[UBound($results)]
If UBound($results) > 5 Then
$win = WinGetPos($ORTLISTE, "")
$con = ControlGetPos($ORTLISTE, "", $ListView1)
WinMove($ORTLISTE, "", $win[0], $win[1], $con[2], $con[3] + UBound($results) * 10)
GUICtrlSetPos($ListView1, $con[0], $con[1], $con[2], $con[3] + UBound($results) * 10)
EndIf
For $a = 2 To UBound($results) - 1
If Not StringInStr($results[$a][0], "Seite:" & @TAB, 2) Then
$listitems[$a] = GUICtrlCreateListViewItem(StringStripWS($results1[$a][0], 1 + 2) & "|" & StringStripWS($results1[$a][1], 1 + 2) & "|" & StringStripWS($results1[$a][2], 1 + 2) & "|" & StringStripWS($results1[$a][3], 1 + 2) & "|" & StringStripWS($results1[$a][4], 1 + 2), $ListView1)
GUICtrlSetOnEvent(-1, "click1")
_GUICtrlListView_SetColumnWidth($ListView1, 0, $LVSCW_AUTOSIZE)
EndIf
Next
EndIf
EndFunc ;==>los
Func labeling()
Select
Case @GUI_CtrlId = $MonthCal1START
Select
Case $click = 0
GUICtrlSetData($Label1, GUICtrlRead($MonthCal1START))
$click = 1
Case $click = 1
GUICtrlSetData($Label2, "")
Select
Case _DateDiff('D', GUICtrlRead($Label1) & " 00:00:00", GUICtrlRead($MonthCal1START) & " 00:00:00") + 1 < 0
GUICtrlSetData($Label2, "")
$click = 1
Case _DateDiff('D', GUICtrlRead($Label1) & " 00:00:00", GUICtrlRead($MonthCal1START) & " 00:00:00") + 1 > 0
GUICtrlSetData($Label2, GUICtrlRead($MonthCal1START))
$click = 0
EndSelect
EndSelect
Case @GUI_CtrlId = $StartButton
Select
Case GUICtrlRead($Label1) <> "" And GUICtrlRead($Label2) <> "" And $ort <> ""
$AnzahlDerTage = _DateDiff('D', GUICtrlRead($Label1) & " 00:00:00", GUICtrlRead($Label2) & " 00:00:00") + 1
If $AnzahlDerTage < 0 Then
GUICtrlSetData($Label2, "")
$click = 1
Else
ReDim $DAYSTRING[$AnzahlDerTage]
EndIf
For $a = 0 To UBound($DAYSTRING) - 1
$teilstring = StringSplit(_DateAdd('d', $a, GUICtrlRead($Label1)), "/", 1)
$DAYSTRING[$a] = "&lc=1&nDate=" & $teilstring[3] & "/" & $teilstring[2] & "/" & $teilstring[1]
Next
GUISetState(@SW_HIDE, $DatumGUI)
los()
Case GUICtrlRead($Label1) = "" Or GUICtrlRead($Label2) = "" Or $ort = ""
MsgBox(0, "", "Es fehlen noch Daten")
EndSelect
EndSelect
EndFunc ;==>labeling
Func click()
If _FFConnect() Then _FFClick(_FFXPath("//table/tbody/tr[" & _GUICtrlListView_GetSelectionMark($ListView1) + 3 & "]/td[1]/a[2]", "", 9))
If _FFLoadWait() Then $url = StringReplace(_FFCmd(".location.href"), "pid=15", "pid=20", 1, 1)
If _FFLoadWait() Then Dim $urlstring[UBound($DAYSTRING)][3]
_FFQuit();>>>>>>>>>>>>>>>>>$DAYSTRING mit for next
$time = TimerInit()
Local $RESULT[1][UBound($DAYSTRING)]
For $a = 0 To UBound($DAYSTRING) - 1
$urlstring[$a][0] = $url & $DAYSTRING[$a]
$urlstring[$a][1] = StringLeft($urlstring[$a][0], StringInStr($urlstring[$a][0], "&nDate=", 2) - 2) & 3 & StringRight($urlstring[$a][0], StringLen($urlstring[$a][0]) - StringInStr($urlstring[$a][0], "&nDate=", 2) + 1)
$urlstring[$a][2] = StringLeft($urlstring[$a][0], StringInStr($urlstring[$a][0], "&nDate=", 2) - 2) & 5 & StringRight($urlstring[$a][0], StringLen($urlstring[$a][0]) - StringInStr($urlstring[$a][0], "&nDate=", 2) + 1)
$tagesresults = _HTML_GetTable(_HTML_GetSource($urlstring[$a][0]), "distilo", "", 5, 16)
Dim $RESULT1[UBound($tagesresults, 1)][UBound($tagesresults, 2)]
$RESULT1 = $tagesresults
$tagesresults = _HTML_GetTable(_HTML_GetSource($urlstring[$a][1]), "distilo", "", 5, 16)
Dim $RESULT2[UBound($tagesresults, 1)][UBound($tagesresults, 2)]
$RESULT2 = $tagesresults
$tagesresults = _HTML_GetTable(_HTML_GetSource($urlstring[$a][2]), "distilo", "", 5, 16)
Dim $RESULT3[UBound($tagesresults, 1)][UBound($tagesresults, 2)]
$RESULT3 = $tagesresults
if UBound($RESULT1, 1)>UBound($RESULT, 1) then ReDim $RESULT[UBound($RESULT1, 1)][UBound($DAYSTRING)];[5]
For $a1 = 0 To UBound($RESULT1, 1) - 1
$RESULT[0][$a] = StringTrimLeft($DAYSTRING[$a], 12)
If $a1 > 0 Then
$zwischen = _StringBetween($RESULT1[$a1][2], '<b>', '</b><br')
$vergleich=StringInStr($zwischen,"ö")
if $vergleich<>0 then
$zwischen =StringReplace($zwischen,"ö","ö")
EndIf
$RESULT[$a1][$a] = __HTML_Filter($RESULT1[$a1][0], 15) & "|" & __HTML_Filter($RESULT1[$a1][3],
& "|" & __HTML_Filter($RESULT3[$a1][3],
& "|" & __HTML_Filter($RESULT2[$a1][3],
& "|" & $zwischen[0]
EndIf
Next
Next
$time1 = TimerDiff($time)
_ArrayDisplay($RESULT, $time1 / 1000)
exit
EndFunc ;==>click
Func click1()
GUISetState(@SW_HIDE, $ORTLISTE)
click()
EndFunc ;==>click1
Func Ende()
_FFQuit()
Exit
EndFunc ;==>Ende
While 1
Sleep(10)
WEnd
der Formatierungsversuch läuft zwischen Zeile 145-148 ab >>>> geht aber nicht
dann hab ichs mal auf die Idiotentour gemacht:
Spoiler anzeigen
$test="Teilweise bewölkt"
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$test' & @lf & @lf & 'Return:' & @lf & $test) ;### Debug MSGBOX
$w=StringInStr($test,"ö")
if $w<>0 then
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$w' & @lf & @lf & 'Return:' & @lf & $w) ;### Debug MSGBOX
$test=StringReplace($test,"ö","ö")
EndIf
MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$test' & @lf & @lf & 'Return:' & @lf & $test) ;### Debug MSGBOX
Das geht.
Weiß einer Rat????
Sorry,hab die html.au3 vergessen,ranzuhängen