Generating and opening file with Automator I am new to Automator. What I am trying to do as first experiment is automating the process of decompiling a Java class file and immediately after open the decompiled file with its default editor.

Following these instructions I managed to decompile a Java class file using this shell script:     

~/bin/jad -lnc -o -d `dirname $1` $1


This will decompile the file class currently selected in the finder. The tool I use (jad) will create in the same directory a file with the same name but a different extension. For example, if the original file was "MyClass.class", then the generated file will be "MyClass.jad".

My question is, how can instruct the Automator to open the generated jad file with its default editor after this being generated in the first action ?

I know I can use the open command in a console to open a file with its default editor, but I do not know how to pass it the right name from Automator.
Add open "${1%.*}".jad on a new line at the end of the script. If you want to open it in a specific application (not the default), change it to open -a "Some Application" "${1%.*}".jad

The $1 is the first argument passed to a script, which in this case is the file path. the ${1%.*} strips the extension (i.e. /Users/you/MyClass.class becomes /Users/you/MyClass), and then .jad is appended, so you get the full path of the new file.