Sign in to follow this  
Followers 0
Phaethon

Circle with MouseClickDrag fucntion

7 posts in this topic

Hey everyone ^_^

I'm coding a simple little script for a couple of my friends and kindof for a geometry class. Anyway, I wanted to draw the word "hello" in mspaint as a simple demonstration of sorts. I ran into a problem with the letter "o" though. This (being able to draw "o's" and curves) will be important later on, so it would help if someone could tell me how to do this. Here's my code so far, if someone could show me what to do for the "o", that'd be great.

;~ H
MouseClickDrag("left",149,115,149,250,0)
MouseClickDrag("left",200,115,200,250,0)
MouseClickDrag("left",149,182.5,200,182.5,0)
;~ E
MouseClickDrag("left",220,115,220,250,0)
MouseClickDrag("left",220,115,270,115,0)
MouseClickDrag("left",220,182.5,260,182.5,0)
MouseClickDrag("left",220,250,270,250,0)
;~ L
MouseClickDrag("left",290,115,290,250,0)
MouseClickDrag("left",290,250,340,250,0)
;~ L
MouseClickDrag("left",360,115,360,250,0)
MouseClickDrag("left",360,250,410,250,0)
;~ O

Thanks :)


Coder's Helper >> Here[center][/center]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey everyone ^_^

I'm coding a simple little script for a couple of my friends and kindof for a geometry class. Anyway, I wanted to draw the word "hello" in mspaint as a simple demonstration of sorts. I ran into a problem with the letter "o" though. This (being able to draw "o's" and curves) will be important later on, so it would help if someone could tell me how to do this. Here's my code so far, if someone could show me what to do for the "o", that'd be great.

;~ H
MouseClickDrag("left",149,115,149,250,0)
MouseClickDrag("left",200,115,200,250,0)
MouseClickDrag("left",149,182.5,200,182.5,0)
;~ E
MouseClickDrag("left",220,115,220,250,0)
MouseClickDrag("left",220,115,270,115,0)
MouseClickDrag("left",220,182.5,260,182.5,0)
MouseClickDrag("left",220,250,270,250,0)
;~ L
MouseClickDrag("left",290,115,290,250,0)
MouseClickDrag("left",290,250,340,250,0)
;~ L
MouseClickDrag("left",360,115,360,250,0)
MouseClickDrag("left",360,250,410,250,0)
;~ O

Thanks :)

Try something like this, which I haven't tested.

Func PCircle($centerX,$Centery,$radius,$speed)
Local $An, $n,$step = 6;the smaller the step the smoother the arc
for $An = 0 to 360 - $step step $step
    $n = $An * 180/3.142;convert degrees to radians
    MouseClickDrag("left",$radius * Cos($n), $radius * sin($n),$radius * Cos($n + $step), $radius * sin($n + $step),$speed)
next
EndFunc
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Try something like this, which I haven't tested.

Func PCircle($centerX,$Centery,$radius,$speed)
Local $An, $n,$step = 6;the smaller the step the smoother the arc
for $An = 0 to 360 - $step step $step
    $n = $An * 180/3.142;convert degrees to radians
    MouseClickDrag("left",$radius * Cos($n), $radius * sin($n),$radius * Cos($n + $step), $radius * sin($n + $step),$speed)
next
EndFunc
That didn't do it man :)

I might have filed in the params wrong, but that doesn't seem to be working for me..


Coder's Helper >> Here[center][/center]

Share this post


Link to post
Share on other sites

If you're doing this as a demonstration of math... then i have no clue...

if you just need to make the letter "O", no questions asked...

why not controlclick the ellipse button in paint and draw a circle

Share this post


Link to post
Share on other sites

That didn't do it man :)

I might have filed in the params wrong, but that doesn't seem to be working for me..

Sorry, here's one that works, my post was full of errors.

HotKeySet("{ESC}", "AExit")
WinActivate("untitled");or whatever the mspaint window title is
WinWaitActive("untitled")
PCircle(200, 200, 50, 0)
Func PCircle($centerX, $Centery, $radius, $speed)
    Local $An, $n, $Astep = 6
    For $An = 0 To 360 Step $Astep
        $n = $An * 3.142 / 180
        $step = $Astep * 3.142 / 180
        MouseClickDrag("left", $centerX + $radius * Cos($n), $Centery + $radius * Sin($n), $centerX + $radius * Cos($n + $step), $Centery + $radius * Sin($n + $step), $speed)
    Next
EndFunc  ;==>PCircle
Func AExit()
    Exit
EndFunc  ;==>AExit

It's a bit slow so it might be quicker to use mousedown("left") then mousemove arounfd the circle


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

If you're doing this as a demonstration of math... then i have no clue...

if you just need to make the letter "O", no questions asked...

why not controlclick the ellipse button in paint and draw a circle

That's a decent idea.. but I kinda need something that is just moving+draging the mouse in such a way that a curve/circle is formed. Thanks for the input though :)


Coder's Helper >> Here[center][/center]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0