[AppleScript] Fotos exportieren und mit Titelinformation speichern

Sushi70

Roter Delicious
Registriert
06.05.17
Beiträge
90
Hallo,
leider habe ich seit dem letzten Update das Problem, daß ich bei dem Script mit der Auswahl der einzelnen Alben (Listenansicht) jeweils nur die Alben angezeigt bekomme, die direkt in "Meine Alben" abgelegt sind. Da ich Ordner zwecks der Übersichtlichkeit angelegt habe (Privat/Familie/Arbeit), werden diese Alben in diesen Ordner nicht angezeigt. Dies war aber vor kurzem noch möglich. Geht das generell nicht mehr oder muß im Script nur etwas geändert werden ?
Über ein paar Tips würde ich mich freuen.
Hier mal das Script:

Code:
on sortList(theList)
    -- from: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Con ceptual/MacAutomationScriptingGuide/ManipulateListsofItems.html
    set theIndexList to {}
    set theSortedList to {}
    try
        repeat (length of theList) times
            set theLowItem to ""
            repeat with a from 1 to (length of theList)
                if a is not in theIndexList then
                    set theCurrentItem to item a of theList as text
                    if theLowItem is "" then
                        set theLowItem to theCurrentItem
                        set theLowItemIndex to a
                    else if theCurrentItem comes before theLowItem then
                        set theLowItem to theCurrentItem
                        set theLowItemIndex to a
                    end if
                end if
            end repeat
            set end of theSortedList to theLowItem
            set end of theIndexList to theLowItemIndex
        end repeat
    on error errMsg number errorNumber
        return {"An unknown error occurred:"} & theSortedList
    end try
    return theSortedList
end sortList

-- select the destination folder  -- Leonie
--set destination to choose folder with prompt "Select a destination folder to save the albums to" default location (the path to the downloads folder as alias)
--set dest to ((the POSIX path of destination) as text) as POSIX file as text

set dest to "/Users/r/Desktop/2019/" as POSIX file as text -- the destination folder (use a valid path). -- change this to your default path for a fixed folder

-- Display a dialog to select the original images or the edited versions

set r to display dialog "Do you want to export the originals or the edited versions?" buttons {"Originals", "Edited versions"} default button 1 with icon 2
set orig to (button returned of r is "Originals")

tell application "Photos"
    activate
    set unsorted to (name of albums)
   
end tell

set l to sortList(unsorted) -- Leonie

set albNames to choose from list l with prompt "Select some albums" with multiple selections allowed


tell application "Photos"
    if albNames is not false then -- not cancelled
        repeat with tName in albNames
            set tFolder to dest & tName
            my makeFolder(tFolder) -- create a folder named (the name of this album) in dest
            if orig then
                export (get media items of album tName) to (tFolder as alias) with using originals --  export the original versions
            else
                export (get media items of album tName) to (tFolder as alias) without using originals -- export the edited versions
            end if
           
        end repeat
    end if
end tell

--tell application "Finder"
--    open (tFolder as alias)
--    return {"Done: "} & albNames
--end tell

on makeFolder(tPath)
    do shell script "mkdir -p " & quoted form of POSIX path of tPath
end makeFolder
 
Zuletzt bearbeitet:

sedna

Galloway Pepping
Registriert
22.10.08
Beiträge
1.358
Hallo,

die Kurzversion lautet:
das ist ein Bug in der Fotos.app 5.0 (macOS Catalina)

Langversion:
Die Fotos.app hat jetzt eine völlig neu gestaltete Datenbank. In der Tabelle der Datenbank, wo man alle Alben vermutet, befinden sich tatsächlich nur die Alben der obersten Ordnerebene, die sogenannten "Top-Level" Alben... also die, die du auch beschrieben hast und die auch gefunden werden.
Alle darauf zugreifenden Programme finden eben auch nur diese... AppleScript, Automator...
Auch bei der Synchronisation mit einem iOS Gerät lassen sich keine anderen Alben synchronisieren.
Sogar die Suchfunktion der Fotos.app selber findet ihre Alben nicht oder sofern doch, dann mit 1 Foto als Inhalt (probiere es mal aus!)
Und leider scheint das auch der Grund zu sein, warum etliche User beim Upgrade auf Fotos.app 5.0 ihre gesamte Ordnerstruktur verloren haben!

Keine Ahnung, ob, wann, und wenn, wie Apple das fixen wird. Und ich kann dir keinen Workaround anbieten!

Gruß
 

Sushi70

Roter Delicious
Registriert
06.05.17
Beiträge
90
Danke, daß ist doch schon mal guter Input.
Was mich auch in den Wahn treibt, daß sich die Alben ablegen wie sie wollen. Vorher legten sie sich nach Datum ordentlich ab, heute mal so - mal so.
Komisch, daß Apple sowas nicht auf dem Schirm hat.