Dynamic stretch according to cursor position

Hi,

I am wondering to create a small script for dynamically stretching cubes (wall) according to the cursor position.

Once the cursor is situated over the end face of the wall the origin of the Scale-1D can change to the opposite face of the geometry. Like this:

So, Actually I need to find the coordinates of the Origin point on the display. Once the cursor is situated on the right hand side of the Origin point the wall is stretching right hand side, once the cursor is on the left hand side of the Origin, the wall will be stretching left hand side by keeping the opposite face (end face of the wall) untouched.

scale1

Moveface