I am trying to create a simple Automator service to quickly change metadata on photos. I would like to be able to select x amount of files, run the service, and get a popup that asks for the f-number I want to change to:

At the moment this is set up to grab selected files in finder, and run the following terminal command:

exiftool -FNumber="1.8" -overwrite_original_in_place "$@"

(exiftool us an application used to edit metadata)

This command works, but the FNumber is hardcoded to 1.8. I would like to be able to dynamically specify the f-number via the "Ask for text" command. However, I don't know how I can ask for text and use the selected files as inputs at the same time. Does anyo


If you're not particularly bound to using Automator's "Ask for text" command, you could do this:

In your service, have the action item be "Run AppleScript" rather than "Run Shell Script"

Use this AppleScript:

on run {input, parameters}
    set myvar to text returned of (display dialog "What F-stop do you want to set?" default answer "1.8")
    repeat with myitem in input
        set myscript to "exiftool -FNumber=\"" & myvar & "\" -overwrite_original_in_place \"" & (POSIX path of myitem) & "\""
        do shell script myscript
    end repeat
end run

enter image description here


Oh well, I was working on doing the same thing as @Daniel.

But I was trying to only pass the exiftool command once. So now you have a choice :-).

  property ExifTool : "PathTo/exiftool -FNumber="
property ExifToolOption : "-FNumber="
on run {input, parameters}
    set pathList to ""
    repeat with i from 1 to count of items of input
        set this_item to item i of input
        set pathList to pathList & space & "\"" & (POSIX path of this_item) & "\"" as string

    end repeat
    display dialog "Enter FNumber" default answer "" buttons {"Cancel", "OK"} default button 2
    set fStop to text returned of the result
    set fStop to fStop as number
    do shell script ExifTool & space & ExifToolOption & fStop & space & "-overwrite_original_in_place" & space & pathList
end run
  • How would you do that not using AppleScript, just using quick action - shell script? – Emmanuel Goldstein Aug 21 '20 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .