automator to run AppleScript for a shell script For a selected file in Finder, I like to run a perl script using Services. I created an Automator process that runs an AppleScript:

on run {input, parameters}
    tell application "Terminal"
        activate
        do script "/Users/myaccountname/Applications/TeXcount_3_0/texcount.pl \"" &amp; (input as string) &amp; "\""
    end tell
end run


The only problem is that the selected filename appears as something like:

"Macintosh HD:Users:myaccountname:Documents:texfile.tex"


which the perl script cannot understand. How can I make it a UNIX-like filename?
You'll need to get the POSIX path of the input file:

on run {input, parameters}
    tell application "Terminal"
        activate
        do script "/Users/myaccountname/Applications/TeXcount_3_0/texcount.pl \"" &amp; ( POSIX path of input as string) &amp; "\""
    end tell
end run


I found the answer over at StackOverflow.