Resize window without clicking issue

With this macro, I can hold down the X and C key and the frontmost window will resize according to mouse movement without clicking regardless of where the mouse pointer is located.

The problem I'm having is if I stop moving the mouse the window continues to resize.

Any ideas how to stop the window resizing when the mouse stops moving without releasing the trigger keys?

resize window.kmmacros (5.2 KB)