Determine element normal directions in Batch mode using tcl

Hi,
I am trying to create a tcl script that is supposed to find the element normal direction for a component/body. I want to run the script in batch mode and obtain the output (normal direction) in a text file. Is there any way I can achieve this? Please refer to the attached snapshots for better understanding.
Note: All element normals for a particular body are in the same direction.
Thanks & Regards,
Roshan
<?xml version="1.0" encoding="UTF-8"?>

Thanks Q.Nguyen-Dai.
With the above code I am able to get normal components in x,y&z directions. But, I am trying to capture whether the normals are inwards or outwards for a particular body.
In HM , visually it is possible to capture this information (depending on the color red or blue ). So, I am looking for a code to capture this without any user intervention.
Please check the example picture for reference.
Try this code:
HTH