GUI "Liveticker"

  • Guten Morgen :]

    Hm mach ich es einfach kurz und knapp.

    Ich möchte aus einer Website Daten auslesen und diese in der GUI eintrage lassen.
    Das hab ich soweit geschafft, nur "ticken" einige Daten, die einen rauf, die anderen runter.
    Wie schaff ich es das diese Daten alle paar Sekunden aktualisiert werden?
    Die Abfrage kann ich nicht in eine While 1 packen.. aber wie mach ich es sonst? :S
    Ich bekomm ja nicht mal soetwas wie ein Refreshbutton hin :(

    Ich hoffe das reicht soweit als Information und ihr könnt mir helfen.

    Gruß
    Sam

  • mh sry aber mit AdLibEnable, kann ich nicht so viel anfangen, bzw weiß gar nicht wo ich das einsetzen soll und vor allem wie 8| xD

    Hier mal mein Code, hab die Daten vom Testnick mal drin gelassen..

    Spoiler anzeigen
    [autoit]

    #include <ButtonConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <TabConstants.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <IE.au3>
    #include <String.au3>
    #include <array.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Datei1 = FileOpen("banner.htm",2)
    FileWrite($Datei1,'<img src="http://www.hast-du-lust.net/lfh/img/banner.png" </img>')
    FileClose($Datei1)

    [/autoit] [autoit][/autoit] [autoit]

    _IEErrorHandlerRegister ()

    [/autoit] [autoit][/autoit] [autoit]

    $url = "http://www.hast-du-lust.net/lfh/logout.php"
    $oIE = _IECreateEmbedded ()
    $icon1 = _IECreateEmbedded()
    #Region ### START Koda GUI section ### Form=c:\users\mikromaxx\desktop\autoit\lfh form.kxf
    $Form1 = GUICreate("Little Fighter Hikers InfoTool 0.5 by mikromaxx", 556, 388, 202, 149)
    $Tab1 = GUICtrlCreateTab(0, 0, 553, 385)
    GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $TabSheet1 = GUICtrlCreateTabItem("Start")
    $Group = GUICtrlCreateGroup("Informationen", 4, 23, 521, 337)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $Group1 = GUICtrlCreateGroup("Login", 16, 52, 129, 161)
    $Input1 = GUICtrlCreateInput("blakeks", 20, 71, 113, 22)
    $Input2 = GUICtrlCreateInput("abc123", 20, 111, 113, 22, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
    $Button1 = GUICtrlCreateButton("Login", 28, 143, 89, 25)
    $Button2 = GUICtrlCreateButton("Logout", 28, 176, 89, 25, 0)
    $Progress1 = GUICtrlCreateProgress(170, 250, 280, 25)
    $GUIActiveX = GUICtrlCreateObj($oIE, 555,387,1,1)
    $banner1 = GUICtrlCreateObj($icon1,170,52,280,180)
    GUICtrlSetState($Button2,$GUI_DISABLE)
    GUICtrlSetState($banner1,$GUI_DISABLE)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUICtrlCreateTabItem("")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###
    _IENavigate ($oIE,$url)
    _IENavigate($icon1,@ScriptDir&"\banner.htm")
    $icon1.document.body.scroll = "no"

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $nMsg = GUIGetMsg()
    Select
    Case $nMsg = $GUI_EVENT_CLOSE
    FileDelete(@ScriptDir&"\banner.htm")
    Exit
    Case $nMsg = $Button1
    $sUsername = GUICtrlRead($Input1)
    $sPassword = GUICtrlRead($Input2)
    GUICtrlSetState($Input1,$GUI_DISABLE)
    GUICtrlSetState($Input2,$GUI_DISABLE)
    GUICtrlSetState($Button1,$GUI_DISABLE)
    GUICtrlSetData($Progress1,20)
    $oform = _IEFormGetCollection($oIE, 0)
    $oname = _IEFormElementGetObjByName($oform , "user")
    $opasswd = _IEFormElementGetObjByName($oform , "pw")
    $setname = _IEFormElementSetValue($oname, $sUsername)
    $setpasswd = _IEFormElementSetValue($opasswd, $sPassword)
    GUICtrlSetData($Progress1,25)
    _IEFormSubmit($oform)
    GUICtrlSetData($Progress1,40)
    GUICtrlSetData($Progress1,50)
    $quell = _IEDocReadHTML($oIE)
    $nick1 = _StringBetween($quell,'idx=1">','<')
    $nick2 = _StringBetween($quell,'idx=2">','<')
    $nick3 = _StringBetween($quell,'idx=3">','<')
    $TabSheet2 = GUICtrlCreateTabItem($nick1[0])
    $oIE2 = _IECreateEmbedded ()
    $GUIActiveX2 = GUICtrlCreateObj($oIE2,555,387,1,1)
    _IENavigate($oIE2,"http://www.hast-du-lust.net/lfh/chars.php?typ=wahl&idx=1")
    $Group2 = GUICtrlCreateGroup("Infos über "&$nick1[0], 4, 23, 521, 337)
    $quell2 = _IEDocReadHTML($oIE2)
    $class2 = _StringBetween($quell2,'Klasse:&nbsp;','<')
    $lvl2 = _StringBetween($quell2,'<BR>Level:&nbsp;','<')
    $xp2 = _StringBetween($quell2,'id=xpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $xp2pro = _StringBetween($quell2,'id=xp style="WIDTH: ','%')
    $hp2 = _StringBetween($quell2,'id=hpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $hp2pro = _StringBetween($quell2,'id=hp style="WIDTH: ','%')
    $mp2 = _StringBetween($quell2,'id=mpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $mp2pro = _StringBetween($quell2,'id=mp style="WIDTH: ','%')
    $sp2 = _StringBetween($quell2,'id=spTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $sp2pro = _StringBetween($quell2,'id=sp style="WIDTH: ','p')
    $att2 = _StringBetween($quell2,'id=angriffzeitcdboxoben>','</')
    If $att2 = 0 Then
    $at2 = '--:--'
    Else
    $at2 = $att2[0]
    EndIf
    $needSP2 = _StringBetween($quell2,'</SPAN> [',']')
    If $needSP2 = 0 Then
    $needSP2 = '/'
    Else
    $needSP2 = $needSP2[0]
    EndIf


    $Label2 = GUICtrlCreateLabel("Klasse: "&$class2[0]&@CRLF&"Level: "&$lvl2[0]&@CRLF&$xp2[0]&@CRLF&$hp2[0]&@CRLF&$mp2[0]&@CRLF&$sp2[0]&@CRLF&"Nächster Angriff: "&$at2&@CRLF&"Benötigte SP: "&$needSP2, 30, 50, 200, 150)
    $xp2prop = GUICtrlCreateProgress(200,78,100,10)
    GUICtrlSetData($xp2prop,$xp2pro[0])
    $hp2prop = GUICtrlCreateProgress(200,90,100,10)
    GUICtrlSetData($hp2prop,$hp2pro[0])
    $mp2prop = GUICtrlCreateProgress(200,102,100,10)
    GUICtrlSetData($mp2prop,$mp2pro[0])
    $sp2prop = GUICtrlCreateProgress(200,114,100,10)
    GUICtrlSetData($sp2prop,$sp2pro[0])
    GUICtrlSetData($Progress1,70)
    $TabSheet3 = GUICtrlCreateTabItem($nick2[0])
    $oIE3 = _IECreateEmbedded ()
    $GUIActiveX3 = GUICtrlCreateObj($oIE3,555,387,1,1)
    _IENavigate($oIE3,"http://www.hast-du-lust.net/lfh/chars.php?typ=wahl&idx=2")
    $Group3 = GUICtrlCreateGroup("Infos über "&$nick2[0], 4, 23, 521, 337)
    $quell3 = _IEDocReadHTML($oIE3)
    $class3 = _StringBetween($quell3,'Klasse:&nbsp;','<')
    $lvl3 = _StringBetween($quell3,'<BR>Level:&nbsp;','<')
    $xp3 = _StringBetween($quell3,'id=xpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $xp3pro = _StringBetween($quell3,'id=xp style="WIDTH: ','%')
    $hp3 = _StringBetween($quell3,'id=hpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $hp3pro = _StringBetween($quell3,'id=hp style="WIDTH: ','%')
    $mp3 = _StringBetween($quell3,'id=mpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $mp3pro = _StringBetween($quell3,'id=mp style="WIDTH: ','%')
    $sp3 = _StringBetween($quell3,'id=spTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $sp3pro = _StringBetween($quell3,'id=sp style="WIDTH: ','p')
    $att3 = _StringBetween($quell3,'id=angriffzeitcdboxoben>','</')
    If $att3 = 0 Then
    $at3 = '--:--'
    Else
    $at3 = $att3[0]
    EndIf
    $needSP3 = _StringBetween($quell3,'</SPAN> [',']')
    If $needSP3 = 0 Then
    $needSP3 = '/'
    Else
    $needSP3 = $needSP3[0]
    EndIf
    $Label3 = GUICtrlCreateLabel("Klasse: "&$class3[0]&@CRLF&"Level: "&$lvl3[0]&@CRLF&$xp3[0]&@CRLF&$hp3[0]&@CRLF&$mp3[0]&@CRLF&$sp3[0]&@CRLF&"Nächster Angriff: "&$at3&@CRLF&"Benötigte SP: "&$needSP3, 30, 50, 200, 150)
    $xp3prop = GUICtrlCreateProgress(200,78,100,10)
    GUICtrlSetData($xp3prop,$xp3pro[0])
    $hp3prop = GUICtrlCreateProgress(200,90,100,10)
    GUICtrlSetData($hp3prop,$hp3pro[0])
    $mp3prop = GUICtrlCreateProgress(200,102,100,10)
    GUICtrlSetData($mp3prop,$mp3pro[0])
    $sp3prop = GUICtrlCreateProgress(200,114,100,10)
    GUICtrlSetData($sp3prop,$sp3pro[0])
    $TabSheet4 = GUICtrlCreateTabItem($nick3[0])
    $oIE4 = _IECreateEmbedded ()
    $GUIActiveX4 = GUICtrlCreateObj($oIE4,555,387,1,1)
    _IENavigate($oIE4,"http://www.hast-du-lust.net/lfh/chars.php?typ=wahl&idx=3")
    $Group4 = GUICtrlCreateGroup("Infos über "&$nick3[0], 4, 23, 521, 337)
    $quell4 = _IEDocReadHTML($oIE4)
    $class4 = _StringBetween($quell4,'Klasse:&nbsp;','<')
    $lvl4 = _StringBetween($quell4,'<BR>Level:&nbsp;','<')
    $xp4 = _StringBetween($quell4,'id=xpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $xp4pro = _StringBetween($quell4,'id=xp style="WIDTH: ','%')
    $hp4 = _StringBetween($quell4,'id=hpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $hp4pro = _StringBetween($quell4,'id=hp style="WIDTH: ','%')
    $mp4 = _StringBetween($quell4,'id=mpTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $mp4pro = _StringBetween($quell4,'id=mp style="WIDTH: ','%')
    $sp4 = _StringBetween($quell4,'id=spTT style="Z-INDEX: 10; VISIBILITY: hidden; POSITION: absolute; TEXT-ALIGN: left; -moz-opacity: 0.95">','<')
    $sp4pro = _StringBetween($quell4,'id=sp style="WIDTH: ','p')
    $att4 = _StringBetween($quell4,'id=angriffzeitcdboxoben>','</')
    If $att4 = 0 Then
    $at4 = '--:--'
    Else
    $at4 = $att4[0]
    EndIf
    $needSP4 = _StringBetween($quell4,'</SPAN> [',']')
    If $needSP4 = 0 Then
    $needSP4 = '/'
    Else
    $needSP4 = $needSP4[0]
    EndIf
    $Label4 = GUICtrlCreateLabel("Klasse: "&$class4[0]&@CRLF&"Level: "&$lvl4[0]&@CRLF&$xp4[0]&@CRLF&$hp4[0]&@CRLF&$mp4[0]&@CRLF&$sp4[0]&@CRLF&"Nächster Angriff: "&$at4&@CRLF&"Benötigte SP: "&$needSP4, 30, 50, 200, 150)
    $xp4prop = GUICtrlCreateProgress(200,78,100,10)
    GUICtrlSetData($xp4prop,$xp4pro[0])
    $hp4prop = GUICtrlCreateProgress(200,90,100,10)
    GUICtrlSetData($hp4prop,$hp4pro[0])
    $mp4prop = GUICtrlCreateProgress(200,102,100,10)
    GUICtrlSetData($mp4prop,$mp4pro[0])
    $sp4prop = GUICtrlCreateProgress(200,114,100,10)
    GUICtrlSetData($sp4prop,$sp4pro[0])
    GUICtrlSetData($Progress1,90)
    GUICtrlSetState($Button2,$GUI_ENABLE)
    ;$TabSheet5 = GUICtrlCreateTabItem("Suche")
    ; $oIE5 = _IECreateEmbedded ()
    ; $GUIActiveX5 = GUICtrlCreateObj($oIE5,555,387,1,1)
    ; _IENavigate($oIE5,"http://www.hast-du-lust.net/lfh/chars.php?typ=wahl&idx=1")
    ; $Group5 = GUICtrlCreateGroup("Suche", 4, 23, 521, 337)
    ; $Input1 = GUICtrlCreateInput("", 16, 40, 161, 21)
    ; $Ok1 = GUICtrlCreateButton("Ok", 16, 80, 73, 25, 0)
    ; $Reset = GUICtrlCreateButton("Reset", 104, 80, 73, 25, 0)
    ; $quell5 = _IEDocReadHTML($oIE5)

    GUICtrlSetData($Progress1,100)
    Case $nMsg = $Button2
    _IENavigate($oIE,$url)
    GUICtrlSetState($Input1,$GUI_ENABLE)
    GUICtrlSetState($Input2,$GUI_ENABLE)
    GUICtrlSetState($Button1,$GUI_ENABLE)
    GUICtrlSetState($Button2,$GUI_DISABLE)
    GUICtrlDelete($TabSheet2)
    GUICtrlDelete($TabSheet3)
    GUICtrlDelete($TabSheet4)
    ;GUICtrlDelete($TabSheet5)
    GUICtrlSetData($Progress1,0)

    EndSelect
    WEnd

    [/autoit]

    Alles ein wenig wirr, ich hoffe ihr seht durch :p

  • Dafür dass du nicht weiß wo du nachgucken musst, hast du schon ganz schön viel an Code fabriziert. Wie wärs mit der Hilfe, dafür ist die da.

  • Ich sagte ja auch nicht das ich überhaupt keine Ahnung habe was ich da mache, aber ich komme halt nicht weiter, hab in der Hilfe gestöbert, hier im Forum, gegoogelt.. entweder ich suche falsch, oder ich finde einfach nichts..

    Kann auch daran liegen das ich die Nacht nicht geschlafen habe, aber im moment fehlen mir einfach die Ideen..

    Wär also nett wenn du/ihr noch ein wenig Hilfestellung geben würdet.

    MfG
    Sam

  • Hier die englische Hilfe:
    http://www.autoitscript.com/autoit3/docs/f…AdlibEnable.htm

    [autoit]

    AdlibEnable("_Refresh", 5000)

    [/autoit][autoit][/autoit][autoit]

    Func _Refresh()
    ;...
    EndFunc

    [/autoit]

    Die 5000 gibt an, wie oft die Funktion aufgerufen werden soll, also hier alle 5 Sekunden. Nebenbei wenn die Funktion nicht aufgerufen ist, läuft das Script weiter, AdLibEnable läuft nebenher weiter und schaltet erst bei den nächsten 5 Sekunden wieder ein. In die Funktion _Refresh() schreibst du halt rein, was du machen willst.