In the industrial sector, efficient production and optimal use of thermal energy are primary concerns for managers and engineers. Considerable research has been devoted to improving and promoting thermal energy efficiency, especially energy recovery in the context of sustainability. Pinch analysis is one of the most powerful methods in this regard. To maximise the energy recovery (MER), the pinch method is well-established in designing an optimal heat exchange network (HEN). Exergy analysis is combined with the pinch method to minimise the work potential loss (exergy loss) while ensuring maximum heat recovery. This study presents a generic algorithm built using Python language to predict and quantify energy and exergy targets in industrial processes. It provides a framework to guide experts and planners in efficiently using the combined analysis tools. The generic algorithm is based on advanced numerical and graphical tools. It provides exergy problem table algorithm (Ex–PTA) and grand composite curve (EHR and HRP) tools. For Δ T min = 10°C, the generic algorithm is implemented in a building complex case study. The energy targets for heating and cooling requirements are 316.2625 kW and 0 kW, respectively. The obtained exergy targets are less attractive given an improvement from advanced utility integration; this is due to the treated system (medium-temperature system) and not to the reliability and efficiency of the generic algorithm. To evaluate the generic algorithm calculations, they are executed in a low-temperature process in which pinch exergy analysis (PExA) has already been performed. The simulated and generated results are identical, demonstrating the reliability and effectiveness of the developed generic algorithm.