Monday, September 25, 2023

Clarion Build Events

SoftVelocity Clarion

Often when I am busy on a Clarion project, I notice something I want to fix or change, and dive straight into the code, forgetting to close the application that is still running. This causes a problem when I try to do a new build, because it can't create the new .exe file while the old one is still in use.
Clarion Enterprise Edition (EE) users have an option to deal with this (see update below), but I have the Professional Edition (PE) and the option isn't available. Microsoft SysInternals to the rescue! In particular, their PsKill and PSList utilities. I made a batch file with the following commands:
@echo off
pskill -t project.exe
pskill -t Debug++.exe
pslist > nul
Replace "project.exe" with the name of the actual exe you are working on. Save the file as project-old.bat or something similar. Theoretically, only PsKill would be required, but if the project.exe isn't running, PsKill will return an error message and the build will fail. PsList solves this by listing the running tasks, and doesn't return an error, so the build will continue.
From the menu, choose "Project", then "Project Options", "Build Events" and type in the name of your project-old.bat file.
Wondering what the Post-build event command line is all about? It's explained in the article: "Backing up your Clarion projects".

Update: The EE option is "Tools" -> "Options" -> "IDE" -> "Projects and Solutions" -> "Kill running process before build".

Update Tesday 2 Otcober 2023: I have updated Zippy.exe to be able to automatically launch the DebugView++.exe program, and project-old.bat now includes a line to close DebugView++.exe if it is running. So you get a fresh debug window when you build a new app.

No comments: