Push-Nachrichten von MacTechNews.de
Würden Sie gerne aktuelle Nachrichten aus der Apple-Welt direkt über Push-Nachrichten erhalten?
Forum>Software>automatisch AppleWorks Dateien als PDF ausdrucken?

automatisch AppleWorks Dateien als PDF ausdrucken?

kbundies
kbundies03.02.1209:41
ich würde gerne (per Automator??) alle AppleWorks Dokumente auf meiner Festplatte (tausende) öffnen und als PDF ausdrucken.
Am besten in dem selben Ordner wie das Original und mit demselben Dateinamen.
Um es etwas interessanter zu machen: bei einigen habe ich es schon per Hand gemacht, diese können/sollen also ausgeschlossen werden.
Kleiner weiterer Haken: viele Dokumente haben ein AutoUpdate Datum im Briefkopf. Also z.B. 11.11.1992. Dieses wird beim Öffnen des Dokuments auf das heutige Datum gesetzt. Der 11.11.1992 ist jedoch im Erstellungsdatum der AppleWorks
Datei vorhanden. Ich vermute, hier gibt es keinen Workaround?
0

Kommentare

_mäuschen
_mäuschen03.02.1210:36

Das wäre ein guter Start https://discussions.apple.com/message/10127260#10127260%2310127260

Müsstest nur noch die entsprechenden `AutoUpdate Daten` neu 'AppleScript'en

good luck

0
kbundies
kbundies03.02.1211:52
_mäschen, ein Super Script was dort hinterlegt ist. Nur jetzt genau einen Tag zu spät. Denn dieses Skript öffnet jedes Dokument automatisch in AppleWorks und druckt es von dort aus als PDF.
Leider stürzt also hier schon AW wieder ab.

Als Alternative dachte ich mir, einen Automator Ablauf mit allen Dateien, die auf .cwk enden zu erstellen.
Ich bin jetzt soweit, daß diese in Pages öffnen.
Jetzt müßte ich es noch hinkriegen, daß diese dann automatisch als PDF gesichert werden. Das habe ich noch noicht hinbekommen.
Auch gibt es natürlich jede Mange Fehlermeldungen, da anhand der Endung cwk natürlich nicht nur Textverarbeitungsdokumente, sondern auch Spreadsheets und Datenbanken dabei sind.
Diese müssten zu Numbers geroutet werden.
Es scheint eine Menge Handarbeit anzuliegen...
0
_mäuschen
_mäuschen03.02.1216:59

Ungefähr so?

set Q to quoted form of ".cwk" -- to make clear what the query is, but could be in the shell script.
-- quoted form is not really necessary for ".scpt", but it's good practice in shell scripts and does no harm in a query argument.
set T to paragraphs of (do shell script "mdfind -onlyin ~/ " & Q) -- mdfind returns a newLine delimited string

set AWwordprocessor to "CWWP"
set AWspreadsheet to "CWSS"
set AWdatabase to "CWDB"
global D, folderName

repeat with F in T
    set I to (info for POSIX file F as alias)
    set D to (creation date of I) as string
    set O to offset of "," in D
    set D to characters (O + 2) thru ((length of D) - 9) of D as string
    if (file type of I) is AWwordprocessor then
        my OpenWithPages(F)
    end if
    if (file type of I) is AWspreadsheet then
        my OpenWithNumbers(F)
    end if
    if (file type of I) is AWdatabase then
        --my OpenWith_D_a_t_e_n_b_a_n_k__A_p_p(F)
    end if
end repeat

on OpenWithPages(F)
    tell application "Pages"
        open F
        activate
    end tell
    set N to (current date) as string
    set O to offset of "," in N
    set N to characters (O + 2) thru ((length of N) - 9) of N as string
    tell application "System Events"
        tell process "Pages"
            keystroke "f" using {command down}
            keystroke N
            keystroke tab
            keystroke D
            click button "Alles ersetzen" of tab group 1 of window "Suchen & Ersetzen"
            click button 1 of window "Suchen & Ersetzen"
            
            keystroke "p" using {command down}
            repeat until window 1 exists
                delay 2
            end repeat
            click menu button "PDF" of sheet 1 of window 1
            click menu item 2 of menu 1 of menu button "PDF" of sheet 1 of window 1
            repeat until window "Sichern" exists
                delay 0.1
            end repeat
            set myPath to F
            my ParentFromPath(myPath, true)
            keystroke "g" using {command down, shift down}
            keystroke folderName
            -- set value of text field 2 of sheet of window "Sichern" to folderName
            click button "Start" of sheet 1 of window 1
            click button "Sichern" of window "Sichern"
            if exists sheet 1 of window 1 then click button 1 of sheet 1 of window "Sichern"
            delay 1
            keystroke "w" using {command down}
            delay 1
            click button 2 of sheet 1 of window 1
        end tell
    end tell
end OpenWithPages

on OpenWithNumbers(F)
    tell application "Numbers"
        open F
        activate
        tell me
            activate
            display dialog "Muss noch ausprogrammiert werden" with icon 0 giving up after 2
        end tell
        activate
        tell application "System Events"
            tell process "Numbers"
                
                --"Muss noch ausprogrammiert werden"
                
                keystroke "w" using {command down}
                delay 1
                click button 2 of sheet 1 of window 1
            end tell
        end tell
    end tell
    delay 1
end OpenWithNumbers

on OpenWith_D_a_t_e_n_b_a_n_k__A_p_p(F)
    tell application OpenWith_D_a_t_e_n_b_a_n_k__A_p_p
        open F
        activate
        
        -- ausprogrammieren
        
    end tell
end OpenWith_D_a_t_e_n_b_a_n_k__A_p_p

on ParentFromPath(thePath, wantPath)
    set thePath to (thePath as text)
    if thePath contains ":" then
        set pathDelim to ":"
    else
        set pathDelim to "/"
    end if
    set saveDelim to AppleScript's text item delimiters
    set AppleScript's text item delimiters to {pathDelim}
    set pathAsList to text items of thePath
    if the last character of thePath is pathDelim then
        set idx to (the number of text items in thePath) - 2
    else
        set idx to -2
    end if
    if wantPath then
        set folderName to ((text items 1 through idx of pathAsList) as text) & pathDelim
    else
        set folderName to item idx of pathAsList
    end if
    set AppleScript's text item delimiters to saveDelim
    return folderName
end ParentFromPath

0

Kommentieren

Diese Diskussion ist bereits mehr als 3 Monate alt und kann daher nicht mehr kommentiert werden.