Previous:Shell-out to Operating System Main Index Next:Shell Command Sequencing

#### String Substitution in Shell Commands

It could get cumbersome to change the `Post_Scene_Command` every time you changed scene names. POV-Ray can substitute various values into a command string for you. For example:

     Post_Scene_Command=tga2gif -d -m %s

POV-Ray will substitute the `%s` with the scene name in the command. The scene name is the `Input_File_Name` or `+I` setting with any drive, directory and extension removed. For example:

     Input_File_Name=c:\povray3\scenes\waycool.pov

is stripped down to the scene name `waycool` which results in...

     Post_Scene_Command=tga2gif -d -m waycool

In an animation it may be necessary to have the exact output file name with the frame number included. The string `%o` will substitute the output file name. Suppose you want to save your output files in a zip archive using the utility program `pkzip`. You could do...

     Post_Frame_Command=pkzip -m %s %o

After rendering frame 12 of `myscene.pov` POV-Ray would shell to the operating system with

     pkzip -m myscene mysce012.tga

The `-M` switch in `pkzip` moves `mysce012.tga` to `myscene.zip` and removes it from the directory. Note that `%o` includes frame numbers only when in an animation loop. During the `Pre_Scene_Command` and `Post_Scene_Command` there is no frame number so the original, unnumbered `Output_File_Name` is used. Any `User_Abort_Command` or `Fatal_Error_Command` not inside the loop will similarly give an unnumbered `%o` substitution.

Here is the complete list of substitutions available for a command string.

`%o` | Output file name with extension and embedded frame number if any
`%s` | Scene name derived by stripping path and ext from input name
`%n` | Frame number of this frame
`%k` | Clock value of this frame
`%h` | Height of image in pixels
`%w` | Width of image in pixels
`%%` | A single % sign.

Previous:Shell-out to Operating System Main Index Next:Shell Command Sequencing