Background delayed action...

BlitzPlus Forums/BlitzPlus Beginners Area/Background delayed action...

Apollonius(Posted 2006) [#1]
I was wondering if it was possible to run a blitz executable in the background while in an another program and do the following:

---------------------
> Delayed 3 Minutes
After Delay
> Press F1
Wait 1 Second
> Left Click at current mouse position
> Wait 8 Second Then Repeat
---------------------
Could someone show me a piece of code that can do this, I'd be eternally greatful.


Regular K(Posted 2006) [#2]
in your decls, add this under win32 (I think win32):
mouse_event%(flags%,x%,y%,data%,extra%)

Repeat
	Delay 60*3*1000 ' delay 3 mins
	
	' here the code for pressing F1 would go
	
	Delay 1000 ' delay a sec
	
	' mess around with these, especially the flags
	' you can control how long to hold the mouse press, etc
	mouse_event(2,0,0,0,0)
	mouse_event(4,0,0,0,0)
	
	Delay 8000 ' delay 8 secs
Forever


For more information on mouse_event: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceshellui5/html/wce50lrfmouseevent.asp

For information on how to simulate a key press:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/keyboardinput/keyboardinputreference/keyboardinputstructures/keybdinput.asp

Virtual keycodes: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp

That should get you on the right track. I find it tricky simulating keyboards, I often get my keyboard mapping screwed up doing it (nothing a restart wouldn't fix).


Apollonius(Posted 2006) [#3]
Weeee Chinese xD