To help you use scripts in Mechanical, many resources are available.
The installed Python scripts that Mechanical uses can be insightful. These scripts are in your Ansys installation directory at .../aisol/DesignSpace/DSPages/Python. Useful scripts include toolbar.py and selection.py. These scripts are run when using many of the options in the Select group on the Mechanical ribbon's Selection tab. For more information, see Selection Tab in the Ansys Mechanical User’s Guide.
The ACT API Reference Guide provides descriptions of all ACT API objects, methods, and properties.