Thursday, December 14, 2017

#1 2006-06-14 03:50:41 pm

lunac
Member
From:: Dulles
Registered: 2003-09-18
Posts: 11

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

/Users/dara/Web/bin/pdfcombine\ Folder/pdfcombine /path/to/my/file.pdf /path/to/my/file2.pdf  -o final.pdf


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

Can anyone help me?


----
it's a crazy world
LunaC

Offline

 

#2 2006-06-14 05:27:02 pm

Bruce Phillips
Administrator
Registered: 2004-07-16
Posts: 2649

Re: Getting automator to run my shell script

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:

Applescript:

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: http://developer.mabwebdesign.com/pdfcombine.html)

Edit: It doesn't use stdin…


Edit: Ok, use this shell script after you select the files:
[code]/Users/dara/Web/bin/pdfcombine\ Folder/pdfcombine "$@" -o /path/to/final.pdf[/code]
You should pass input as arguments (that's the "$@").

Offline

 

#3 2006-06-14 08:45:35 pm

lunac
Member
From:: Dulles
Registered: 2003-09-18
Posts: 11

Re: Getting automator to run my shell script

That works perfectly! Thanks.
big_smile


----
it's a crazy world
LunaC

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)