# _MouseMoveAngle

## Recommended Posts

I needed a function to move the mouse in a certain angle, but couldnt find a existing one.

So I dug up my math books and came up with this.

```Func _MouseMoveAngle(\$i_Degrees, \$i_Lenght, \$i_Speed = 1)
\$i_xChange = Sin(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$ai_cPos = MouseGetPos()
MouseMove(\$ai_cPos[0] + \$i_xChange, \$ai_cPos[1] - \$i_yChange, \$i_Speed)
EndFunc```

##### Share on other sites

cool!

nice job!!

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

##### Share on other sites

Open Paint and click pencil. Then run this.

Good job.

```Sleep(1500)
WinActivate("untitled - Paint")
MouseDown("left")
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
MouseUp("left")
Func _MouseMoveAngle(\$i_Degrees, \$i_Lenght, \$i_Speed = 1)
\$i_xChange = Sin(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$ai_cPos = MouseGetPos()
MouseMove(\$ai_cPos[0] + \$i_xChange, \$ai_cPos[1] - \$i_yChange, \$i_Speed)
EndFunc
oÝ÷ Øw«{ljz-êèãåiÇ²¢êæ¢ëv'æ«¶¢ÛhíêZ{pwhÂØ^»§Ö®¶­s`¥6ÆVWS¥vä7FfFRgV÷C·VçFFÆVBÒçBgV÷C²¤Ö÷W6TF÷vâgV÷C¶ÆVgBgV÷C²¥ôÖ÷W6TÖ÷fTævÆRCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÂ#Â¥ôÖ÷W6TÖ÷fTævÆRÂsRÂ¥ôÖ÷W6TÖ÷fTævÆR#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆR3cÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓ#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRÓCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓÂ#Â¥ôÖ÷W6TÖ÷fTævÆRÓÂsRÂ¥ôÖ÷W6TÖ÷fTævÆRÓ#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRÓ3cÂSÂ¥ôÖ÷W6TÖ÷fTævÆR#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÂ#Â¥ôÖ÷W6TÖ÷fTævÆRÂsRÂ¥ôÖ÷W6TÖ÷fTævÆR#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆR3cÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓ#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRÓCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓÂ#Â¥ôÖ÷W6TÖ÷fTævÆRÓÂsRÂ¥ôÖ÷W6TÖ÷fTævÆRÓ#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRÓ3cÂSÂ¥ôÖ÷W6TÖ÷fTævÆR#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆRCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓCRÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÂ#Â¥ôÖ÷W6TÖ÷fTævÆRÂsRÂ¥ôÖ÷W6TÖ÷fTævÆR#sÂ3Â¥ôÖ÷W6TÖ÷fTævÆR3cÂSÂ¥ôÖ÷W6TÖ÷fTævÆRÓ#sÂ3Â¤Ö÷W6UWgV÷C¶ÆVgBgV÷C²¤gVæ2ôÖ÷W6TÖ÷fTævÆRb33c¶ôFVw&VW2Âb33c¶ôÆVævBÂb33c¶õ7VVBÒ¢b33c¶÷6ævRÒ6âb33c¶ôFVw&VW2òSrã#SssS3#2¢b33c¶ôÆVæv@¢b33c¶÷6ævRÒ6÷2b33c¶ôFVw&VW2òSrã#SssS3#2¢b33c¶ôÆVæv@¢b33c¶ö5÷2ÒÖ÷W6TvWE÷2¢Ö÷W6TÖ÷fRb33c¶ö5÷5³Ò²b33c¶÷6ævRÂb33c¶ö5÷5³ÒÒb33c¶÷6ævRÂb33c¶õ7VVB¤VæDgVæ0 oÝ÷ Øº(É"Ö¥GrX}ÚºÚ"µÍÛY
ML
BÚ[XÝ]]J  ][ÝÝ[]YHZ[    ][ÝÊB[ÝÙQÝÛ   ][ÝÛY ][ÝÊBÓ[ÝÙS[ÝP[ÛJ

KMLL
BÓ[ÝÙS[ÝP[ÛJM
KMLL
BÓ[ÝÙS[ÝP[ÛJNLL
BÓ[ÝÙS[ÝP[ÛJ
ÍKL
BÓ[ÝÙS[ÝP[ÛJÌÌL
BÓ[ÝÙS[ÝP[ÛJÍ
LL
BÓ[ÝÙS[ÝP[ÛJLÌÌL
BÓ[ÝÙS[ÝP[ÛJM
KMLL
BÓ[ÝÙS[ÝP[ÛJ

KMLL
BÓ[ÝÙS[ÝP[ÛJLNLL
BÓ[ÝÙS[ÝP[ÛJL
ÍKL
BÓ[ÝÙS[ÝP[ÛJLÌÌL
BÓ[ÝÙS[ÝP[ÛJLÍ
LL
BÓ[ÝÙS[ÝP[ÛJÌÌL
BÓ[ÝÙS[ÝP[ÛJ

KMLL
BÓ[ÝÙS[ÝP[ÛJM
KMLL
BÓ[ÝÙS[ÝP[ÛJNLL
BÓ[ÝÙS[ÝP[ÛJ
ÍKL
BÓ[ÝÙS[ÝP[ÛJÌÌL
BÓ[ÝÙS[ÝP[ÛJÍ
LL
BÓ[ÝÙS[ÝP[ÛJLÌÌL
BÓ[ÝÙS[ÝP[ÛJM
KMLL
BÓ[ÝÙS[ÝP[ÛJ

KMLL
BÓ[ÝÙS[ÝP[ÛJLNLL
BÓ[ÝÙS[ÝP[ÛJL
ÍKL
BÓ[ÝÙS[ÝP[ÛJLÌÌL
BÓ[ÝÙS[ÝP[ÛJLÍ
LL
BÓ[ÝÙS[ÝP[ÛJÌÌL
BÓ[ÝÙS[ÝP[ÛJ

KMLL
BÓ[ÝÙS[ÝP[ÛJM
KMLL
BÓ[ÝÙS[ÝP[ÛJNLL
BÓ[ÝÙS[ÝP[ÛJ
ÍKL
BÓ[ÝÙS[ÝP[ÛJÌÌL
BÓ[ÝÙS[ÝP[ÛJÍ
LL
BÓ[ÝÙS[ÝP[ÛJLÌÌL
B[ÝÙU
][ÝÛY ][ÝÊB[ÈÓ[ÝÙS[ÝP[ÛJ  ÌÍÚWÑYÜYË ÌÍÚWÓ[Ú    ÌÍÚWÔÜYYHJB    ÌÍÚWÞÚ[ÙHHÚ[ ÌÍÚWÑYÜYÈÈ
ËMMÍÎMLLÌÊH
ÌÍÚWÓ[Ú    ÌÍÚWÞPÚ[ÙHHÛÜÊ ÌÍÚWÑYÜYÈÈ
MËMMÍÎMLLÌÊH
ÌÍÚWÓ[Ú    ÌÍØZWØÔÜÈH[ÝÙQÙ]ÜÊ
B[ÝÙS[ÝJ ÌÍØZWØÔÜÖÌH
È  ÌÍÚWÞÚ[ÙK ÌÍØZWØÔÜÖÌWHH   ÌÍÚWÞPÚ[ÙK    ÌÍÚWÔÜYY
B[[Â```
Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

##### Share on other sites

Thats nice, but why are :

```\$i_xChange = Sin(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght```

the same return values ?

Like :

\$i_xChange == \$i_yChange

Edited by Busti

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

##### Share on other sites

Nice UDF!

@Busti

They are not the same, run this and you will see

"FalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalse

FalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalse"

```Sleep(1500)
WinActivate("untitled - Paint")
MouseDown("left")
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-180, 210, 10)
_MouseMoveAngle(-0, 75, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-360, 50, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-180, 210, 10)
_MouseMoveAngle(-0, 75, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-360, 50, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
MouseUp("left")
Func _MouseMoveAngle(\$i_Degrees, \$i_Lenght, \$i_Speed = 1)
\$i_xChange = Sin(\$i_Degrees / 7.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght
ConsoleWrite(\$i_xChange=\$i_yChange)
\$ai_cPos = MouseGetPos()
MouseMove(\$ai_cPos[0] + \$i_xChange, \$ai_cPos[1] - \$i_yChange, \$i_Speed)
EndFunc```
Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

##### Share on other sites

Thats nice, but why are :

the same return values ?

Cos(360) = 1

Sin(360) = 0

You can see that there's quite a big difference between Sine and Cosine.

Btw, Firestorm, very cool script's! I tried all three of them.

##### Share on other sites

Nice UDF!

@Busti

They are not the same, run this and you will see

"FalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalse

FalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalseFalse"

```Sleep(1500)
WinActivate("untitled - Paint")
MouseDown("left")
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-180, 210, 10)
_MouseMoveAngle(-0, 75, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-360, 50, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-180, 210, 10)
_MouseMoveAngle(-0, 75, 10)
_MouseMoveAngle(-270, 300, 10)
_MouseMoveAngle(-360, 50, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(45, 150, 10)
_MouseMoveAngle(-45, 150, 10)
_MouseMoveAngle(180, 210, 10)
_MouseMoveAngle(0, 75, 10)
_MouseMoveAngle(270, 300, 10)
_MouseMoveAngle(360, 50, 10)
_MouseMoveAngle(-270, 300, 10)
MouseUp("left")
Func _MouseMoveAngle(\$i_Degrees, \$i_Lenght, \$i_Speed = 1)
\$i_xChange = Sin(\$i_Degrees / 7.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght
ConsoleWrite(\$i_xChange=\$i_yChange)
\$ai_cPos = MouseGetPos()
MouseMove(\$ai_cPos[0] + \$i_xChange, \$ai_cPos[1] - \$i_yChange, \$i_Speed)
EndFunc```
becouse the math is diff... :

\$i_xChange = Sin(\$i_Degrees / 7.2957795130823) * \$i_Lenght

\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght

change it to :

\$i_xChange = Sin(\$i_Degrees / 57.2957795130823) * \$i_Lenght

\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght

and test again.

My UDF's : Startet on : 06.06.2006_CaseSearchOrReplaceStr();~> Searches OR Replaces a String,;~> With or Without Casesensivity

##### Share on other sites

Oops. Its still the same result though

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

##### Share on other sites

Second hand CLOCK

```HotKeySet( "{esc}", "Quit" )
MouseMove( @DesktopWidth/2, @DesktopHeight/2 )
\$pos = MouseGetPos()
While 1
MouseMove( \$pos[0], \$pos[1], 0 )
_MouseMoveAngle( (360*@SEC)*.01, 100 )
WEnd

Func _MouseMoveAngle(\$i_Degrees, \$i_Lenght, \$i_Speed = 1)
\$i_xChange = Sin(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$i_yChange = Cos(\$i_Degrees / 57.2957795130823) * \$i_Lenght
\$ai_cPos = MouseGetPos()
MouseMove(\$ai_cPos[0] + \$i_xChange, \$ai_cPos[1] - \$i_yChange, \$i_Speed)
EndFunc
Func Quit()
Exit
EndFunc```

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

##### Share on other sites

Heh nice zero cool!

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

##### Share on other sites

Heh nice zero cool!

ty

[center]AutoIT + Finger Print Reader/Scanner = COOL STUFF -> Check Out Topic![/center][center][font=Arial Black]Check out ConsultingJoe.com[/font][/center][center]My Scripts~~~~~~~~~~~~~~Web Protocol Managing - Simple WiFi Scanner - AutoTunes - Remote PC Control V2 - Audio SpectrascopePie Chart UDF - At&t's TTS - Custom Progress Bar - Windows Media Player Embed[/center]

##### Share on other sites

I like the clock idea

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...