Getting automator to run my shell script

Ok, I got this cool shell script for combining pdfs. I love it except it would be nice if it were a little more automated in the way file paths etc.

I can’t figure out how to pass files into “run shell script”. Maybe I’m missing something.

Anyway I’m trying to run

Basically, I want to select the files >>> then pass the file paths to the above script >> then run.

Can anyone help me?

Well, I know the shell script would need POSIX paths to the files, but it probably won’t receive them that way; I think you’d have to send the paths through an AppleScript to convert them, and at that point, you could just run the shell script from inside the AppleScript too.

After your files are choose:

on run {input, parameters}
    set command to "/Users/dara/Web/bin/pdfcombine\\ Folder/pdfcombine "
    repeat with thisItem in input
        set command to command & quoted form of POSIX path of thisItem & space
    end repeat
    do shell script command & "-o final.pdf"
end run

Edit: Actually, the shell script does receive a list of POSIX paths. I’ll try something else then. (FYI: NameBright - Coming Soon)

Edit: It doesn’t use stdin.

Edit: Ok, use this shell script after you select the files:

/Users/dara/Web/bin/pdfcombine\ Folder/pdfcombine "$@" -o /path/to/final.pdf

You should pass input as arguments (that’s the “$@”).

That works perfectly! Thanks.