The OSA Macro Program Function enables automated measurement by creating programs for entry of measurement conditions and other tasks. Users can program a sequence of measurement procedures from entry of measurement conditions (e.g., wavelength sweep width, setting resolution) to analyses, data saving, output, and others and eliminates redundant procedures on the production line. The function acts as a controller of other connected devices through the LAN or RS232C port and allows users to build an automatic measuring system without using an external PC and input measurement conditions or output measured results while programs are running.