Script (FolderAction)

mib2000

mib2000

Aktives Mitglied
Thread Starter
Dabei seit
14.10.2004
Beiträge
1.230
Reaktionspunkte
113
Hallo

Kennt jemand ein Script/Automation das ein Folder überwacht und sobald ein neues Element vom Typ "Bild" (jpg, jpeg, heic) rein kommt, dieses dann in einen anderen Folder kopiert?

Vielen Dank
Gruss
 
Google -> Ordneraktionen

oder willst du ein fertiges script haben?
 
Code:
on adding folder items to getFolder after receiving newItems
   tell application "Finder"
       repeat with x in newItems
           if name extension of x is in {"jpg", "png", "tiff", "JPG", "jpeg", "JPEG", "PNG", "TIFF"} then move x to "andererFolder"
       end repeat
   end tell
end adding folder items to
 
  • Gefällt mir
Reaktionen: tocotronaut
oder Hazel
 
  • Gefällt mir
Reaktionen: Bozol
Code:
on adding folder items to getFolder after receiving newItems
   tell application "Finder"
       repeat with x in newItems
           if name extension of x is in {"jpg", "png", "tiff", "JPG", "jpeg", "JPEG", "PNG", "TIFF"} then move x to "andererFolder"
       end repeat
   end tell
end adding folder items to
Geht schon in die Richtung. Aber geht das Konstrukt "x is in { ... }" wirklich? Bei mir nämlich nicht. Da passiert: nichts

@mib2000:

Mit dem ersten Entwurf hier bin hat es bei mir funktioniert.
Code:
on adding folder items to getFolder after receiving newItems
    set picture_destination_path to "/Users/user/Desktop/Bildschirmfotos"
    set picture_file_extension to {"png", "PNG"}
    tell application "Finder"
        -- display dialog newItems as text
        repeat with x in newItems
            -- display dialog x as text
            set name_extension to name extension of x as text
            -- display dialog name_extension
            -- if picture_file_extension contains name_extension then display dialog "Picture!"
            if picture_file_extension contains name_extension then move x to POSIX file picture_destination_path with replacing
        end repeat
    end tell
end adding folder items to

Edit: Das können die Experten hier bestimmt noch verbessern. Bin kein AppleScript-Profi.
 
Zurück
Oben Unten