Public Access
show_mail_templates unterscheidet jetzt zwischen Aufruf aus dem Menü autonom) oder Aufruf auf _belegversand.applescript. Probelm danach: In _belegversand wird show_mail_templates entweder als *.scpt (kompiliert) oder *.applescript (Textdatei) aufgerufen. Dateiendungen müssen demnach angepasst werden. Daher Einführung der neuen Funktione on compileAllScripts(basePath) in der Datei _belegversand_setup.applescript.
This commit is contained in:
@@ -53,6 +53,7 @@ property requiredConfigKey : "BELEGE_ROOT_UUID="
|
||||
property mainScriptName : "_belegversand.scpt"
|
||||
-- Versionsinformation für README und Hinweise.
|
||||
property appVersion : "1.4"
|
||||
property basePath : "/Library/Application Scripts/com.devon-technologies.think/Menu/Belegversand"
|
||||
-- Default-Werte für die Erstkonfiguration.
|
||||
property defaultMailTo : "steuer@name.de"
|
||||
property defaultSubjectPrefix : "Unterlagen"
|
||||
@@ -62,6 +63,69 @@ property defaultSentTagForDocs : "gesendet"
|
||||
property defaultWriteDebugLog : "false"
|
||||
property defaultShowReadme : "true"
|
||||
property defaultDryRunPreviewPath : "/tmp/DT-Belegversand-preview.txt"
|
||||
|
||||
(*
|
||||
compileAllScripts(basePath)
|
||||
--------------------------
|
||||
Kompiliert alle AppleScript-Quellen (.applescript) zu ausführbaren Scripts (.scpt).
|
||||
|
||||
WARUM:
|
||||
- Im Git-Repo liegen nur .applescript-Dateien (Plaintext für Versionskontrolle)
|
||||
- AppleScript kann aber nur .scpt-Dateien (kompiliert) laden via "load script"
|
||||
- Nach git clone sind nur .applescript vorhanden → kein Versand möglich
|
||||
|
||||
WAS:
|
||||
- Iteriert über alle 6 Scripts im Projekt
|
||||
- Ruft osacompile auf (macOS Tool)
|
||||
- Liest .applescript-Quelle
|
||||
- Schreibt .scpt-Binary
|
||||
- Löscht die .applescript danach (sauberer: nur .scpt bleibt)
|
||||
|
||||
PFAD-PROBLEM:
|
||||
- basePath MUSS absolut sein (ab Home, mit do shell script "echo ~")
|
||||
- Relative Pfade funktionieren nicht zuverlässig in AppleScript
|
||||
- Deshalb wird basePath als Parameter übergeben, nicht lokal definiert
|
||||
|
||||
WICHTIG:
|
||||
- Diese Funktion wird nur beim Setup aufgerufen (nach git clone)
|
||||
- Sie ist kein Fehler, wenn .applescript nicht existiert (z.B. bei AirDrop-Kopie)
|
||||
*)
|
||||
on compileAllScripts(basePath)
|
||||
tell application id "DNtp"
|
||||
my writeDebug("compileAllScripts: Start")
|
||||
end tell
|
||||
|
||||
set filesToCompile to {"START.applescript", ¬
|
||||
"Helpers/show_mail_templates.applescript", ¬
|
||||
"Helpers/create-year-cycle.applescript", ¬
|
||||
"Helpers/uuid_anzeigen.applescript", ¬
|
||||
"Helpers/scripts/_belegversand_setup.applescript", ¬
|
||||
"Helpers/scripts/_belegversand.applescript"}
|
||||
|
||||
repeat with fileName in filesToCompile
|
||||
set sourceFile to basePath & "/" & fileName
|
||||
set outputFile to basePath & "/" & (text 1 thru -13 of fileName) & ".scpt"
|
||||
|
||||
try
|
||||
do shell script "osacompile -o " & quoted form of outputFile & " " & quoted form of sourceFile
|
||||
-- Nach Kompilierung: .applescript löschen
|
||||
do shell script "rm " & quoted form of sourceFile
|
||||
tell application id "DNtp"
|
||||
my writeDebug("Compiled & removed: " & filename)
|
||||
end tell
|
||||
on error errMsg
|
||||
tell application id "DNtp"
|
||||
my writeDebug("Compile ERROR: " & filename & " - " & errMsg)
|
||||
end tell
|
||||
end try
|
||||
end repeat
|
||||
|
||||
tell application id "DNtp"
|
||||
my writeDebug("compileAllScripts: Done")
|
||||
end tell
|
||||
end compileAllScripts
|
||||
|
||||
|
||||
(*
|
||||
runSiblingScript(scriptFileName)
|
||||
--------------------------------
|
||||
@@ -73,7 +137,7 @@ Verwendung:
|
||||
*)
|
||||
on runSiblingScript(scriptFileName)
|
||||
-- Absolute Basis-Path (Home + fest Installation)
|
||||
set basePath to (do shell script "echo ~") & "/Library/Application Scripts/com.devon-technologies.think/Menu/Belegversand_1-4"
|
||||
set basePath to (do shell script "echo ~") & basePath
|
||||
set targetPath to basePath & "/Helpers/scripts/" & scriptFileName
|
||||
|
||||
try
|
||||
@@ -230,6 +294,7 @@ Freie Kommentar- oder Trennerzeilen sind daher unproblematisch.
|
||||
on buildConfigText(mailToDefault, mailCcToDefault, subjectPrefix, zipPasswordDefault, logSentGroupName, belegeRootUUID, writeDebugLogValue, showReadmeValue, readmeUUID, mailBodyFolderName, mailBodyRecordName, sentTagForDocs, dryRunPreviewPath)
|
||||
return "## Benutzer-Einstellungen - bitte individuell anpassen." & return & ¬
|
||||
"## Eine Kurz-Doku findest du in der Datei README-Belegversand.md" & return & return & ¬
|
||||
"APP_VERSION=" & appVersion & return & ¬
|
||||
"MAIL_TO_DEFAULT=" & mailToDefault & return & ¬
|
||||
"MAIL_CC_TO_DEFAULT=" & mailCcToDefault & return & ¬
|
||||
"MAIL_SUBJECT_PREFIX=" & subjectPrefix & return & ¬
|
||||
@@ -612,6 +677,18 @@ on run
|
||||
set debugInfoText to ""
|
||||
end if
|
||||
|
||||
if writeDebugLogValue is "true" then
|
||||
set debugInfoText to return & return & "Debug-Log: /tmp/DT-Belegversand-debug.log"
|
||||
else
|
||||
set debugInfoText to ""
|
||||
end if
|
||||
|
||||
-- Absolute Basis-Path für Script-Kompilierung
|
||||
set basePath to (do shell script "echo ~") & basePath
|
||||
|
||||
compileAllScripts(basePath)
|
||||
set compileHint to return & return & "✓ Scripts kompiliert"
|
||||
|
||||
display dialog "Belegversand wurde eingerichtet." & return & return & ¬
|
||||
"Datenbank-Wurzel: " & dbRootName & return & ¬
|
||||
"Belege-Gruppe: " & belegeRootName & return & ¬
|
||||
|
||||
Reference in New Issue
Block a user