Page 1 of 1
Shake Mouse!
Posted: Tue Apr 07, 2009 4:57 pm
by Peyman
Lets Fun
Code: Select all
Procedure ShakeMouse(shakiness.l)
rect.POINT
GetCursorPos_(rect)
randX = Random(1)
randY = Random(1)
If randX = 0
XX = rect\x - shakiness
Else
XX = rect\x + shakiness
EndIf
If randY = 0
YY = rect\y - shakiness
Else
YY = rect\y + shakiness
EndIf
SetCursorPos_(XX, YY)
EndProcedure
For a=0 To 1000
Delay(1)
ShakeMouse(2)
Next
Posted: Tue Apr 07, 2009 5:04 pm
by Kaeru Gaman
what's your PB version?
the SetCursorPos call is not correct that way.
Posted: Tue Apr 07, 2009 5:13 pm
by Hroudtwolf
Hi,
Nice idea. Funny ^^
Just another try.
Code: Select all
Procedure ShakeMouse( nIntensity.i , tmTimeMS.i )
Protected ptMouse.POINT
Protected nX .i
Protected nY .i
Protected tmEndMS.i
Protected nCount .i
GetCursorPos_( ptMouse )
tmEndMS = ElapsedMilliseconds () + tmTimeMS
While tmEndMS > ElapsedMilliseconds ()
nX = ptMouse\x + ( Sin ( nCount ) * Random ( nIntensity ) )
nY = ptMouse\y + ( Cos ( nCount ) * Random ( nIntensity ) )
SetCursorPos_( nX , nY )
nCount = ( nCount + 1 ) % 360
Delay ( 10 )
Wend
ProcedureReturn #Null
EndProcedure
ShakeMouse ( 15 , 500 )
Regards
Wolf
Posted: Tue Apr 07, 2009 5:14 pm
by Sparkie
Kaeru Gaman wrote:the SetCursorPos call is not correct that way.
Looks correct to me. What would you consider the correct way

Posted: Tue Apr 07, 2009 5:29 pm
by Kaeru Gaman
did I mix momething up?
I thought, API calls awaiting a POINT meanwhile expect the full 64bit Struct as parameter, not two separated 32bit values.
just like WindowFromPoint etc.
Posted: Tue Apr 07, 2009 9:16 pm
by Sparkie
SetCursorPos_ doesn't use a POINT structure, it uses two integers, x and y.
Posted: Tue Apr 07, 2009 10:07 pm
by Kaeru Gaman
ok, sorry....
the API is inconsistent there, but I could have looked it up.
Posted: Thu Apr 09, 2009 3:05 pm
by Andesdaf
@Peyman & Wolf:
funny idea.

It ist difficult to click on the "kill program" button with this
code

Posted: Thu Apr 09, 2009 3:42 pm
by Demivec
Andesdaf wrote:@Peyman & Wolf:
funny idea.

It ist difficult to click on the "kill program" button with this
code

I tested the code with a drawing program. I started the MouseShake, then I switched to the drawing program and held down the mouse buttons to draw. It produced a rather nice scribble pattern.

Posted: Sat Apr 11, 2009 4:52 pm
by Andesdaf
Demivec wrote:Andesdaf wrote:@Peyman & Wolf:
funny idea.

It ist difficult to click on the "kill program" button with this
code

I tested the code with a drawing program. I started the MouseShake, then I switched to the drawing program and held down the mouse buttons to draw. It produced a rather nice scribble pattern.

Oh yes, that's funny

.
With Hroudtwolf's code, i can't move the mouse no longer and so it draws
a thing like a ball.
Posted: Sat Apr 11, 2009 5:02 pm
by pdwyer
Imagine a "nag" that did that to you while the software was unregistered
