For some reason the name of thePath comes up as not defined by my Automator workflow.

on run {input, parameters}
    tell application "Finder"
        set thePath to the (first item of the input)
        set namedFolder to ((the name of thePath) as text)
        set namedFolder to ((text 1 thru 13) of namedFolder)
    end tell
    return namedFolder
end run
  • 2
    Are you still a user of SOF? You have not responded to accept the apparently correct answer. – javadba Sep 10 '16 at 20:05
  • There are various reasons why a person might not respond. Checking SavgStorm's profile, for example, we see "Last seen Nov 11 '14 at 15:15" - a significant time prior to "Sep 10 '16 at 20:05". Just upvote answers that work for you, and move on. – leanne Feb 17 '18 at 19:19

namedFolder only exists in the scope of your tell block. Define it first thing so that it will persist after you’re done with Finder.

set namedFolder to ""
tell application "Finder"
end tell
return namedFolder

Alternatively, you could just put the return statement inside the tell block.

| improve this answer | |

You must log in to answer this question.

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