# API Scripts that Run In Both CADFEKO and POSTFEKO

Scripts can be written such that they work both in CADFEKO and POSTFEKO.

The following example is written so that it creates a Form dialog displaying the phrase “Hello world!” in CADFEKO.

form = cf.Form.New("Demonstration")
label = cf.FormLabel.New("Hello world!")
form:Run()

Running the same script would fail in POSTFEKO, since the cf interface is not available. The script can be extended to run in either application by prepending it with a single line:

cf = cf or pf

This tells the script that if the CADFEKO interface (cf) is unavailable, that the POSTFEKO interface (pf) should be used instead. Any alias can be specified, meaning that an even more neutral name can be given.

feko = cf or pf
form = feko.Form.New("Demonstration")
label = feko.FormLabel.New("Hello world!")
form:Run()