Hotfolder met Automator+Applescript
6 april 2024 - 22:35   
geplaatst door: Prdele
Ik ben bezig met het maken van een hotfolder om daar foto's in te gooien en dan een output van 420px in een andere map.

Ik heb een map aangemaakt en die heet "Hotfolder, Verklein naar 420px" en in die map staat een map die heet "420px"
In Photoshop heb ik al een handeling aangemaakt.
In Automator heb ik bij nieuw gekozen voor "Mapactie" en vervolgens de juiste map geselecteerd.
Dan heb ik een Applescript geplaatst in Automator.
Maar ik krijg het helaas niet aan de gang

Ik zie even niet wat ik fout doet.

De Applescript:
on run {input, parameters}
    tell application "Adobe Photoshop 2024"
        activate
        repeat with imagePath in input
            open imagePath as alias
            do action "Verklein naar 420px" of "420px"
            set outputFolderPath to ((characters 1 through ((offset of "Hotfolder, Verklein naar 420px" in (imagePath as text)) + length of "Hotfolder, Verklein naar 420px") of (imagePath as text)) as string) & ":420px:"
            set outputFile to (outputFolderPath & (name of (info for imagePath))) as string
            save the front document in file outputFile as JPEG with options {quality: 10, formatOptions: Standard}
            close the front document without saving
        end repeat
    end tell
    return input
end run

PS-handeling.jpgHotfolder met Automator+Applescript
Hotfolder met Automator+Applescript
7 april 2024 - 14:20    reactie #1
geplaatst door: mcmt
Ik kan dit ietwat simuleren met de Preview app (op Monterey), als volgt.

on run {input, parameters}
tell application "Preview"
activate
repeat with imagePath in input
open imagePath as alias
-- do action "Verklein naar 420px" of "420px"
set outputFolderPath to ((characters 1 through ((offset of "Hotfolder, Verklein naar 420px" in (imagePath as text)) + (length of "Hotfolder, Verklein naar 420px")) of (imagePath as text)) as string) & "420px:"
set outputFile to (outputFolderPath & (name of (info for imagePath))) as string
save the front document in file outputFile -- as JPEG with options {quality: 10, formatOptions: Standard}
close the front document without saving
end repeat
end tell
return input
end run

Achteraan lijn 7 heb ik & ":420px:" moeten vervangen door & "420px:"