On a more serious note... there's TONS of programs out there that do this for you and allow for basic scripting such as macro express, autoit and many, many others.
The issue is that the client has checks in place for such systems and will most likely just get you bot jailed far faster then doing any more effective botting framework ever would. For example... I wrote, tested and released a proxy based framework for botting and in ALL my testing I never once got botjailed. Same with a hook based framework. If I had done the same thing with a simple click based macro, you can bet your ass I'd have been auto bot jailed quite quickly.