Unrar item help

I love automation. Now, I’ve got an Automator script to run when a file finishes downloading, moves it to a folder, and imports it into iTunes.

What I don’t know how to do is a step between those to run an Applescript or shell script to unrar the file inputted from Automator and then return the unrared file back for further actions.

Your help is appreciated.

Have you tried the Run AppleScript action? This action can receive input from the previous action and return a list for the next action to work with. If you look at this thread, you can get some idea for how that works.

Good luck,

Sorry, my bad. What I meant to write was: I don’t know how to write an Applescript to unrar an item.

That’s cool. I am happy to help you if I can, but I have never heard of rar or unrar. Can you enlighten me, or direct me to an info source?

RAR is a compressed archive format, like ZIP.

I’ve gone ahead and installed a RAR command line utility. Now, I can unrar a file in Terminal like so:

unrar x compressed-package.rar

OK, so how do I use that above code as a step in Automator? How do I specify the input variable, and how do I get the shell to return the unrared file back to Automator?

You pass a filename as a variable to a Run Shell Script action in this manner, and as long as unrar recognizes it, it will be expanded:

unrar "$@"

Over toward the top right of the Run Shell Script window, you will see a pop up list entitled Pass Input: - Be sure that you select the as arguments option.

As for getting it back to the next action, I am not sure. You may be forced to send the un-rared files to a folder that has a folder action connected for further processing. I will look into that later this evening if i get a chance.