Hier ist mal ein Beispiel fernab von irgendwelchen Loggin-Programmen ...
Das Programm ließt aus den Wiki-Seiten von AviSynth.org die aktuellen Funktionen, Plugins usw. aus und erstellt daraus einen Edit-Mode für jEdit.
Programm:
Spoiler anzeigen
#Region Includes
#include <Array.au3>
#include <FF.au3>
#EndRegion Includes
$_FF_COM_TRACE = False
[/autoit] [autoit][/autoit] [autoit]Global $aFunctions[1], $aResult[1], $aArray
Global $sFunctions = ''
Global $URL_plugins = "http://avisynth.org/mediawiki/External_plugins"
Global $URL_filters = "http://avisynth.org/mediawiki/Internal_filters"
Global $aURL[9]
$aURL[0] = "http://avisynth.org/mediawiki/Internal_functions/Numeric_functions"
$aURL[1] = "http://avisynth.org/mediawiki/Internal_functions/String_functions"
$aURL[2] = "http://avisynth.org/mediawiki/Internal_functions/Boolean_functions"
$aURL[3] = "http://avisynth.org/mediawiki/Internal_functions/Conversion_functions"
$aURL[4] = "http://avisynth.org/mediawiki/Internal_functions/Control_functions"
$aURL[5] = "http://avisynth.org/mediawiki/Internal_functions/Multithreading_functions"
$aURL[6] = "http://avisynth.org/mediawiki/Internal_functions/Version_functions"
$aURL[7] = "http://avisynth.org/mediawiki/Internal_functions/Runtime_functions"
$aURL[8] = "http://avisynth.org/mediawiki/Clip_properties"
Main()
Exit
;===============================================================================
Func Main()
If _FFConnect() Then
For $i = 0 To UBound($aURL) - 1
While 1
_FFOpenURL($aURL[$i])
If Not @error And _FFSearch("Navigation") Then ExitLoop
Sleep(1000)
WEnd
$sFunctions &= @CRLF & @CRLF & "<!-- " & _FFXpath("//li[@id='lastmod']", "last modified on", 13) & " -->" & @CRLF
$sFunctions &= "<!-- " & StringMid($aURL[$i], StringInStr($aURL[$i], "/", 2, -1) + 1) & " -->" & @CRLF & _FilterFunctions(2)
Sleep(500)
Next
While 1
_FFOpenURL($URL_filters)
If Not @error And _FFSearch("Navigation") Then ExitLoop
Sleep(1000)
WEnd
_ReadTables(2)
$sFunctions &= @CRLF & @CRLF & "<!-- " & _FFXpath("//li[@id='lastmod']", "last modified on", 13) & " -->" & @CRLF
$sFunctions &= "<!-- Internal filters -->" & @CRLF & _FilterPlugins("2")
Dim $aFunctions[1]
Dim $aResult[1]
While 1
_FFOpenURL($URL_plugins)
If Not @error And _FFSearch("Navigation") Then ExitLoop
Sleep(1000)
WEnd
_ReadTables(2)
$sFunctions &= @CRLF & @CRLF & "<!-- " & _FFXpath("//li[@id='lastmod']", "last modified on", 13) & " -->" & @CRLF
$sFunctions &= "<!-- Plugins -->" & @CRLF & _FilterPlugins("3")
_Write($sFunctions)
Else
MsgBox(64, "ERROR:", "Can't connect to FireFox")
EndIf
EndFunc ;==>Main
;===============================================================================
Func _FilterFunctions($iKey)
Local $aArr
For $i = 0 To 10
$aArr = _FFXpath("//div[@id='content']/div[@id='bodyContent']/ul/li/span[1]", Default, 6)
If Not @error Then ExitLoop
Next
_ArraySort($aArr)
_ArrayDelete($aArr, 0)
For $i = 0 To UBound($aArr) - 1
$aArr[$i] = @TAB & @TAB & @TAB & "<KEYWORD" & $iKey & ">" & $aArr[$i] & "</KEYWORD" & $iKey & ">"
Next
Return _ArrayToString($aArr, @CRLF)
EndFunc ;==>_FilterFunctions
;===============================================================================
; filtering external plugins
Func _FilterPlugins($iKey)
Local $sSTag = "<KEYWORD" & $iKey & ">"
Local $sETag = "</KEYWORD" & $iKey & ">"
Local $tmp
ReDim $aResult[UBound($aFunctions)]
For $i = 1 To UBound($aFunctions) - 1
$aFunctions[$i] = StringStripWS($aFunctions[$i], 3)
If StringRegExp($aFunctions[$i], '^\d+$') Then ContinueLoop
$tmp = StringRegExpReplace($aFunctions[$i], '[\[\]]+', '') ; filter []
$tmp = StringRegExpReplace($tmp, '\s*/\s*', $sETag & @CRLF & @TAB & @TAB & @TAB & $sSTag)
$aResult[$i] = @TAB & @TAB & @TAB & $sSTag & $tmp & $sETag
Next
For $i = 0 To UBOund($aResult)-1
$tmp = $aResult[$i]
$aResult[$i] = StringRegExpReplace($tmp, '(.*?<.*?>)(\w+)\s.*?(</.*?>.*?)', '$1$2$3')
If $tmp <> $aResult[$i] Then $aResult[$i] &= " <!-- " & StringRegExpReplace($tmp, '.*?<.*?>(.*?)</.*?>', '$1') & " -->"
Next
_ArraySort($aResult)
$aResult = _ArrayUnique($aResult)
_ArrayDelete($aResult, 0) ; count
;_ArrayDisplay($aResult)
Return _ArrayToString($aResult, @CRLF)
EndFunc ;==>_FilterPlugins
;===============================================================================
; reading tables
Func _ReadTables($iTable)
While True
For $i = 0 To 10
Sleep(200)
$aArray = _FFXPath("//div[@id='bodyContent']/table[" & $iTable & "]//tr/td[1]", Default, 6, 1)
If Not @error Then ExitLoop
Next
If UBound($aArray) < 2 Then
ExitLoop
Else
_ArrayConcatenate($aFunctions, $aArray)
EndIf
$iTable += 1
WEnd
EndFunc ;==>_ReadTables
;===============================================================================
; writing xml-file
Func _Write($sFunctions)
Local $fileOut = @ScriptDir & "/avs.xml"
Local $fileIn = @ScriptDir & "/avs.xml.template"
If FileExists($fileIn) Then
Local $sFile = FileRead($fileIn)
Local $hFile = FileOpen($fileOut, 2)
If Not @error Then
$sFile = StringReplace($sFile, "%DATE%", @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC)
FileWrite($hFile, StringReplace($sFile, "<!-- insert -->", $sFunctions))
Else
MsgBox(64, "ERROR: Opening output-file:", $fileOut)
EndIf
FileClose($hFile)
Else
MsgBox(64, "ERROR: Template not found:", $fileIn)
EndIf
EndFunc ;==>_Write
Source-Code und xml-Template ist im Anhang.