How to execute interactive script?

Hi there I would like to make a script somehow interactive. For example let’s say I would like to create a very simple script. When I click with the mouse on the viewport a cube object will be added to the scene.

I would like more information based on relative subjects, and about available mouse input events.

Use the Object→Action→Settings paradigm, and Blender will do most of the hard work for you.

More details here,_Action,_Settings_New. If in doubt, start from the beginning, here