Link zu TimelinePortable: https://portableapps.com/node/38124
Der Code (mit Beispiel) exportiert die Struktur timeline in xml und überarbeitet nachträglich die Datei, weil das XML aus der Purebasic-lib und das XML von Timelineportable passt nicht zusammen.
Viel Spass beim langweilen,
Syr2
Code: Alles auswählen
Structure event
start.s
end.s
text.s
description.s
EndStructure
Structure displayed_period
start.s
end.s
EndStructure
Structure view
displayed_period.displayed_period
hidden_categories.s
EndStructure
Structure timeline
version.s
categories.s
List events.event()
view.view
EndStructure
Global timeline.timeline
Procedure.s FormatTime(day,month,year,hour,minute,second)
Returnstring.s = ""
Returnstring + Str(year)+"-"+Str(Month)+"-"+Str(day)+" "+Str(Hour)+":"+Str(Minute)+":"+Str(Second)
ProcedureReturn Returnstring
EndProcedure
Procedure ModifyXmlFile(name.s)
emptyxmlnodeRegex = CreateRegularExpression(#PB_Any,"<([^/<>]+)/>")
content.s = ""
f= OpenFile(#PB_Any,name)
If Not f
ProcedureReturn
EndIf
While Eof(f) = 0
content+ReadString(f)+#LF$
Wend
CloseFile(f)
content = ReplaceString(content,"element>","event>")
ExamineRegularExpression(emptyxmlnodeRegex,content)
While NextRegularExpressionMatch(emptyxmlnodeRegex)
replaceTag.s = RegularExpressionGroup(emptyxmlnodeRegex,1)
content = ReplaceString(content,"<"+replaceTag+"/>","<"+replaceTag+"> "+"</"+replaceTag+">")
Wend
f= OpenFile(#PB_Any,name)
WriteString(f,content)
CloseFile(f)
EndProcedure
Procedure MakeTimeLine(Filename.s="")
xml = CreateXML(#PB_Any)
InsertXMLStructure(RootXMLNode(xml),timeline,timeline)
If Filename = ""
Filename.s = SaveFileRequester("Timeline speichern",GetCurrentDirectory()+"result.timeline","*.timeline",-1)
EndIf
SaveXML(xml,Filename)
ModifyXmlFile(Filename)
EndProcedure
;Data to save
timeline\version = "0.12.1"
timeline\categories = ""
AddElement(timeline\events())
With timeline\events()
\description = "Description"
\start = FormatTime(01,01,2021,01,01,0)
\end = FormatTime(01,01,2021,01,01,0)
\text = "Test"
EndWith
timeline\view\displayed_period\start = FormatTime(01,01,2021,01,01,0)
timeline\view\displayed_period\end = FormatTime(01,02,2021,01,01,0)
MakeTimeLine()