Adding a "Program to Execute" step to the project file from a template

Applies to: the thread names no Clarion version and no template chain; the code is plain template language.

Problem

A template should switch a small program on or off that runs after COMPILE and before RUN. Doing it by hand means adding the program at the bottom of the project's "programs to execute" list. The poster knew #RUN but not where to place anything so that it lands in the IDE's build sequence.

Solution

  1. #PROJECT('Your.exe') does not do it: it only adds the named file to the project (a second poster, Aug 2004).
  2. Add a batch file once, by hand, to the project's "programs to execute" section so that it always runs.
  3. Let the template write that batch file with #CREATE, #CLOSE and #RUN. When the option is off, the file holds only a REM line; when on, it holds the program name. The code was cut from a version-info template of the poster who suggested it:
#AT(%BeforeGenerateApplication)
#DECLARE(%JCSProjectFileName)
#SET(%JCSProjectFileName, ('your.exe'))
#IF(%DONT_RUN)
#CREATE(%JCSProjectFileName)
REM your.exe
#CLOSE(%JCSProjectFileName)
#ELSE
#CREATE(%JCSProjectFileName)
your.exe
#CLOSE(%JCSProjectFileName)
#ENDIF
#ENDAT

Caveats

  • The original poster never reported whether this worked, and asked whether someone at SoftVelocity could say more; the archive holds no such reply.
  • The code as quoted writes a file named like the program and does not show the batch file's own name or extension.
  • The thread did not say how to remove the project entry again; the batch file stays and only its content changes.

Today (2026)

Not re-tested. The #CREATE / #CLOSE pair is likely still the way a template writes a file, but how current project files treat the "programs to execute" list was not checked.

Sources: Charles E. (Aug 2004, the question), Jason S. (Aug 2004), James C. (Aug 2004) in softvelocity.clarion.templates.