Timeline 3D mit Applescript automatisieren
Nutzen Sie Applescript um Zeitleisten in Ihre Arbeitsabläufe zu integrieren
Die Applescript-Technologie kann genutzt werden, um mit Timeline 3D und anderen Produkten und Quellen automatisch Zeitleisten zu erstellen.
Die Struktur eines Timeline-Dokuments
Wenn Sie die Struktur eines Timeline-Dokuments verstehen, fällt Ihnen das Verfassen eines Skripts viel leichter:
Dokument (document): Oberstes Objekt, dass geöffnet, geschlossen und auf der Platte gespeichert werden kann. Kontrolliert auch das Aussehen des Hintergrunds und die Ansichten.
Zeile (row): Im Dokumentobjekt enthalten. Eine Zeitleiste kann eine oder mehrere Zeilen enthalten. Die Zeilen können mit Labels versehen werden und über Einstellungen für das Aussehen konfiguriert werden. Beachten Sie, dass die Timeline-Benutzeroberfläche alle Zeilen eines Ereignisses mit dem gleichen Aussehen ausstattet. Mittels der Skripte können Sie aber verschiedene Werte für jede einzelne Zeile innerhalb eines Ereignisses individuell bestimmen.
Ereignis (event): Befindet sich im Zeilenobjekt. Ereignisobjekte enthalten Daten für jedes Ereignis, wie auch die Einstellungen für das Aussehen (wie Farbe etc.).
Ein Musterskript für das Erstellen einer Zeitleiste rezenter E-Mailnachrichten
Dieses Skript zeigt Ihnen wie Sie Applescript nutzen können, mittels jedem Programm, dass die Skriptsprache unterstützt Zeitleistendiagramme zu erstellen.
tell application "Timeline 3D"
activate
set newDoc to make new document
tell newDoc
-- hide the intro panel
set showing panel to false
-- bulk edit view is much faster for large timelines
set view mode to bulk edit view
set name of first row to "MOST RECENT E-MAILS" -- set the row label
-- create a new event for each message
repeat with messageNumber from 1 to 20
tell application "Mail"
set myMessage to message messageNumber of inbox
set mySubject to (subject of myMessage) as string
set myDate to date received of myMessage
set mySender to sender of myMessage
end tell -- end tell application "Mail"
tell first row to make new event with properties {¬
name:mySubject,¬
notes:mySender,¬
starting date:myDate,¬
URL:"http://www.beedocs.com",¬
image:"/Applications/Mail.app/Contents/Resources/app.icns",¬
image size:50,¬
colorR:1.0, colorG:0, colorB:0.5, colorA:1.0}
-- If there was a media file to associate with each event,
-- it would be added to the properties in this format:
-- media:"/Users/myaccount/Music/audio.mp3",
end repeat
set view mode to screen view -- back to screen view after the changes
end tell -- end tell newDoc
end tell -- end tell application "Timeline 3D"
Musterskript für die Konvertierung einer Zeitleiste zu HTML
In diesem Skript wird das vorderste Timeline-Dokument in eine einfache HTML-Datei konvertiert. Schritt für Schritt.
tell application "Timeline 3D"
set header to "<head><style>h1, h2, p { font-family: helvetica; font-size: 9pt; margin:0} h1 { font-size: 12pt; margin-top: 25px; } h2 { font-weight: normal; font-style: italic; margin-bottom: 10px; } p { color:#555; }</style></head>" & return & "<body style='width:400px'>" & return
set eventContents to ""
tell first row of front document
repeat with myEvent in events
set eventLabel to my encode_text(name of myEvent)
set eventDate to my encode_text(displayed range of myEvent)
set eventNotes to my encode_text(notes of myEvent)
set eventContents to eventContents & tab & "<h1>" & eventLabel & "</h1><h2>" & eventDate & "</h2>" & return
if the length of eventNotes is greater than 0 then
set eventContents to eventContents & "<p>" & eventNotes & "</p>" & return
end if
set eventImage to my encode_text(image of myEvent)
if the length of eventImage is greater than 0 then
set eventContents to eventContents & "<img src=\"" & eventImage & "\">" & return
end if
end repeat
end tell
set footer to "</body>"
set output to header & eventContents & footer
end tell
on encode_text(this_text) -- required to prep text for html
set the encoded_text to ""
repeat with this_char in this_text
if this_char as string is equal to "<" then
set the encoded_text to (the encoded_text & "<") as string
else if this_char as string is equal to "&" then
set the encoded_text to (the encoded_text & "&") as string
else if this_char as string is equal to (ASCII character 10) as string then
set the encoded_text to (the encoded_text & "<br />") as string
else
set the encoded_text to (the encoded_text & this_char) as string
end if
end repeat
return the encoded_text
end encode_text