This article describes approaches to the use of scenarios in the automation of applied tasks within the framework of working with a software complex of optical modeling and photorealistic computer graphics. Optical modeling complex should include support for scripting, since conventional tools, such as those provided using a graphical user interface, are usually not enough to perform a variety of tasks that arise in practice. A brief overview of existing solutions is made. Methods are proposed that ensure effective bringing of scenario support into an existing optical modeling system. These methods provide full access from scripts to system modules, including computational modules, various simulator modules, etc. Both trivial scripts containing ordinary command sequences and more complex ones using the capabilities of high-level scripting languages such as Python are supported. Separately, a special high-level API is considered which is used for the interaction between of scripts written in the Python language and the optical modeling system. This API can also be used to extend the capabilities of the system with new parametric objects. The specialized software modules integrated into the optical modeling system, such as the batch interpreter, script interpreter and editor, extension class editor, are considered in detail. Examples of scenario-based modeling automation are given.