Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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 "$@"

http://imgur.com/pfAI8

(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

share|improve this question

2 Answers 2

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

share|improve this answer

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.