Keypress/macro commands?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Keypress/macro commands?

Post by PB »

I often need to send a keypress or a mouseclick in my apps, but the API code to
do so is quite long to type. Here's two simple examples:

Press Space:
keybd_event_(#VK_SPACE,0,0,0) : keybd_event_(#VK_SPACE,0,#KEYEVENTF_KEYUP,0)

Left mouse click:
mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0) : mouse_event_(#MOUSEEVENTF_LEFTUP,0,0,0,0)

It'd be great to have two new commands to replace these, such as:

KeyPress(#VK_SPACE) ; Accept any standard #VK_* constant.
MouseClick(#VK_LBUTTON) ; Also accept #VK_RBUTTON and #VK_MBUTTON.

Should be fairly easy to implement...? :)