Initial commit: v1.4 with documentation

This commit is contained in:
2026-08-15 17:04:43 +02:00
parent 7c976e8619
commit 9838a86660
8 changed files with 503 additions and 0 deletions
+79
View File
@@ -0,0 +1,79 @@
tell application id "DNtp"
set monthNames to {"01_Januar", "02_Februar", "03_MŠrz", "04_April", "05_Mai", "06_Juni", "07_Juli", "08_August", "09_September", "10_Oktober", "11_November", "12_Dezember"}
set monthVariants to {"januar", "jan", "january", Â
"februar", "feb", "february", Â
"mŠrz", "maerz", "mrz", "mŠr", "march", "mar", Â
"april", "apr", Â
"mai", "may", Â
"juni", "jun", "june", Â
"juli", "jul", "july", Â
"august", "aug", Â
"september", "sep", "sept", Â
"oktober", "okt", "october", "oct", Â
"november", "nov", Â
"dezember", "dez", "december", "dec"}
set selRecs to selection as list
if (count of selRecs) is 0 then
display dialog "Bitte einen Ordner in DEVONthink auswŠhlen." buttons {"OK"} default button "OK"
return
end if
set targetGroup to first item of selRecs
set targetName to name of targetGroup
set normalizedTargetName to my normalizeMonthFolderName(targetName)
if monthVariants contains normalizedTargetName then
set answerButton to button returned of (display dialog "Du stehst im Ordner " & targetName & ". Willst du hier trotzdem einen Jahreszyklus anlegen?" buttons {"Abbrechen", "Ja"} default button "Ja" with icon caution)
if answerButton is "Abbrechen" then return
end if
repeat with i from 1 to count of monthNames
set monthName to item i of monthNames
try
create record with {name:monthName, type:group} in targetGroup
end try
end repeat
try
create record with {name:"Versendet", type:group} in targetGroup
end try
display dialog "Fertig." buttons {"OK"} default button "OK"
end tell
on normalizeMonthFolderName(theName)
set t to (do shell script "printf %s " & quoted form of theName & " | tr '[:upper:]' '[:lower:]'")
set t to my replaceText(".", "", t)
set t to my replaceText("_", " ", t)
set t to my replaceText("-", " ", t)
set t to my trimText(t)
try
set t to do shell script "printf %s " & quoted form of t & " | sed -E 's/^[0-9]{1,3}[[:space:]]+//; s/^[0-9]{1,3}//'"
on error
-- falls sed zickt, einfach Original weiterverwenden
end try
set t to my trimText(t)
return t
end normalizeMonthFolderName
on replaceText(findText, replaceWith, sourceText)
set AppleScript's text item delimiters to findText
set textItems to every text item of sourceText
set AppleScript's text item delimiters to replaceWith
set newText to textItems as text
set AppleScript's text item delimiters to ""
return newText
end replaceText
on trimText(t)
set whitespaceChars to {space, tab, return, linefeed}
repeat while t is not "" and (character 1 of t is in whitespaceChars)
set t to text 2 thru -1 of t
end repeat
repeat while t is not "" and (character -1 of t is in whitespaceChars)
set t to text 1 thru -2 of t
end repeat
return t
end trimText
Binary file not shown.
Binary file not shown.
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
(*
uuid_anzeigen.scpt
Zeigt Name, Typ und UUID des aktuell ausgewŠhlten DEVONthink-Objekts an.
Die UUID wird zusŠtzlich in die Zwischenablage kopiert.
Zweck:
- Diagnose
- manuelles Nachschlagen einer DEVONthink-UUID
- Vorbereitung fŸr das manuelle Aktualisieren von BELEGE_ROOT_UUID
*)
tell application id "DNtp"
set sel to selection
if sel is {} then error "Bitte zuerst ein Objekt in DEVONthink auswŠhlen."
set r to item 1 of sel
set recName to name of r as text
try
set recType to type of r as text
on error
set recType to "unbekannt"
end try
set recUUID to uuid of r as text
end tell
set the clipboard to recUUID
display dialog "AusgewŠhltes Objekt:" & return & return & Â
"Name: " & recName & return & Â
"Typ: " & recType & return & Â
"UUID: " & recUUID & return & return & Â
"Die UUID wurde in die Zwischenablage kopiert." buttons {"OK"} default button "OK"