• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Das Monatsmotto Juli lautet -- Kitsch as Kitsch can -- Jeder von Euch kann dafür ganz individuell bestimmen, was für ihn Kitsch ist und ein Foto davon einsenden. Macht mit, traut Euch! --> Klick

[Fotos] Applescript: Mediatheken in der Familie Synchronisieren

cusertrumpl

Thurgauer Weinapfel
Registriert
04.02.08
Beiträge
999
<div class="bbWrapper">Ich habe ein Skript geschrieben, mit dem ich prüfen kann welche Fotos von mir, meine Frau noch nicht hat und umgekehrt. Da wir nur die meisten, aber nicht alle Ordner synchronisieren wollen, gibt es ein Album, über das Bilder ausgeschlossen werden können.<br /> <br /> Gerne möchte ich es euch zur Verfügung stellen und freue mich über Kommentare.<br /> <br /> Funktionsweise:<br /> <ol> <li data-xf-list-type="ol">Auf beiden Rechnern mit dem Skripteditor eine App mit dem angegebenen Code erstellen.</li> <li data-xf-list-type="ol">Die App auf Rechner A ausführen und eine Datei speichern (evtl. gleich in geteiltem Ordner)</li> <li data-xf-list-type="ol">Auf Rechner B ein Album &quot;Nicht teilen&quot; anlegen für die Bilder, die A nicht braucht.</li> <li data-xf-list-type="ol">Die Datei mit der gleichen App öffnen (Drag 'n Drop).</li> </ol>Das Skript legt jetzt ein Album an, dass alle Fotos enthält, die A vielleicht gerne möchte. A kann sich jetzt an B's Rechner setzten und sich die Fotos holen, die er mag. Die restlichen schiebt er ins Album &quot;Nicht teilen&quot; fürs nächste mal.<br /> <br /> <br /> Anmerkung: Das Skript vergleicht die Bilder nur basierend auf dem Aufnahmedatum. Haben Bilder kein Aufnahmedatum (WhatsApp) wird das Änderungsdatum verwendet.<br /> <br /> <div class="bbCodeBlock bbCodeBlock--screenLimited bbCodeBlock--code"> <div class="bbCodeBlock-title"> AppleScript: </div> <div class="bbCodeBlock-content" dir="ltr"> <pre class="bbCodeCode" dir="ltr" data-xf-init="code-block" data-lang="applescript"><code>on AppleScriptDateToString(b) set Y to year of b set M to Twodigits(month of b as integer) set D to Twodigits(day of b) set hh to Twodigits(hours of b) set mm to Twodigits(minutes of b) set ss to Twodigits(seconds of b) return Y &amp; &quot;-&quot; &amp; M &amp; &quot;-&quot; &amp; D &amp; &quot; &quot; &amp; hh &amp; &quot;:&quot; &amp; mm &amp; &quot;:&quot; &amp; ss as text end AppleScriptDateToString on Twodigits(a) return (characters -2 thru -1 of ((&quot;0&quot; &amp; a) as text)) as text end Twodigits on run set theFile to open for access (choose file name) with write permission tell application &quot;Photos&quot; set theDates to date of media items set theoutputString to &quot;&quot; repeat with theDate in theDates set t to my AppleScriptDateToString(theDate) &amp; &quot; &quot; --log t set theoutputString to theoutputString &amp; t end repeat write theoutputString to theFile end tell close access theFile end run on open dateien set datei to item 1 of dateien set alredyThereDates to paragraphs of (read file datei) tell application &quot;Photos&quot; set exAlbum to item 1 of (albums whose name is &quot;Nicht teilen&quot;) set excludeIds to id of (media items of exAlbum) set theDates to date of media items set theIds to id of media items set theCounter to 0 set theAlbum to make new album named &quot;Evtl. teilen&quot; repeat with theId in theIds set theCounter to theCounter + 1 if excludeIds does not contain theId then set theDate to item theCounter of theDates set t to my AppleScriptDateToString(theDate) if alredyThereDates does not contain t then add {item theCounter of media items} to theAlbum log &quot;add&quot; else log &quot;already there&quot; end if else log &quot;excluded&quot; end if end repeat end tell end open</code></pre> </div> </div></div>