### 5.25 Exec

• Exec( <program> [, <argument(s)>, <working directory>, <wait>, <show window>] ).
• Description: the function executes a <program> (or a script) specifying any <arguments> and a <working directory>, the three other arguments are interpreted as strings. The argument <wait> whose value is $0$ (default) or $1$, indicate that the program has to wait or not the end of the process. The last argument <show window> whose value is $0$ (default) or $1$, indicate if the executing window has to be visible or not, that argument is valid under windows. The function returns Nil. An error message is displayed if: resources are insufficient, or the program is invalid, or the path is invalid.
• the predefined string TmpPath contains the path to a temporary directory. The macro Apercu exports the current graphic in that directory using the pgf format in the file file.pgf , then execute pdflatex on the file apercu.tex, and wait until the end of the execution before launching the pdf reader.
• Exemple(s): the macro Apercu contained in interface.mac is:
[Export(pgf,[TmpPath,"file.pgf"]),
Exec("pdflatex", ["-interaction=nonstopmode apercu.tex"],TmpPath,1),