You can use the record in the mechanical scripting console, and add the directional deformation , etc., and you will see the commands (e.g., AddDirectionalDeformation(), AddEquivalentStress(), etc.)
On how to het the max/min from these results, one can get that by:
equivalent_stress = ExtAPI.DataModel.Project.Model.Analyses.Solution.AddEquivalentStress()
Then export MaxVMSt to a csv file. Search the internet how to export there are many posts on that, e.g., :
Finally group is a bit hard, but not really needed in order to create the results, extract max/min and export these values.
If needed folders/groups look at the below link for an example that adds these results and puts them into a folder.
All the best