Sign in to follow this  
Followers 0
Neoborn

MoveMousie 1.0 - Programming For Fun Problem

29 posts in this topic

#1 ·  Posted (edited)

Hello Guys,

I am trying to figure out a problem within my current program. Here it is below

; ------------------------------------------------------------------------------
;   AutoIt Version: 3.1.1.123
;   Language:       English
;   Creator:        Neoborn
;   Email:          <neo underscore born at hotmail dot com>
;   Description     Mouse Mover
;   Version:        1.0
; ------------------------------------------------------------------------------
; ------------------------------------------------------------------------------
;   PseudoCode:
;   1. Find out the size of the desktop
;   2. Move the mouse to the top left hand corner to start from.
;   3. Move mouse around the full four sides of the screen 1" from the edge
;   4. Once a full circuit has been completed it will increase in speed & move
;      in another 1" or so and complete another circuit
;   5. It will continue to do this until reaching the middle the another event
;      will occur and the program will either loop or end.
; ------------------------------------------------------------------------------
Opt("MouseCoordMode", 0)

;==============================================
; Variables
;==============================================
Local $DW = @DesktopWidth, $DH = @DesktopHeight, $CMP = MouseGetPos(), $MS = 100, $PM = 100, $PN = 50, $DWPN = $DW - $PN, $DHPN = $DH - $PN, $DHPM = $DH - $PM

;==============================================
;   Function Calls
;==============================================
MouseMv()

;==============================================
;   Functions
;==============================================
Func MouseMv()

    $i = 0
    While $i <= 3
        MouseMove($PN, $PN, $MS)
        MouseMove($DWPN, $PN,$MS)
        MouseMove($DWPN, $DHPN,$MS)
        MouseMove($PM, $DHPN, $MS)
        MouseMove($PM, $PM, $MS)
        exit
;~      $PN = $PN + $PN
;~      $PM = $PM + $PM
;~      $DWPN = $DWPN - $PN
;~      $DHPN = $DHPN - $PN
;~      $MS = $MS - 30
        
        $i = $i +1
    WEnd

EndFunc

;~  MsgBox(64, "Mouse Position is...", "Mouse position is " & $CMP[0] & " x " & $CMP[1])
;~ MsgBox(64,"Your desktop is...", "Desktop size is: " & $DesktopW & " X " & $DesktopH)

Please read Pseudocode for explanation of how the program works.

1. I know it exits out ; this is for testing

2. I know my loop is currently not working and I have much variables etc commented out ; this is for testing

Questions:

Please if you are willing to help me please don't just give me the answer but instead guide me a little on how to do what I need i.e. look up this in the helpfile, what you want to do is create an array etc but don't just code it for me as I will learn nought :(

1. I know there is a way to make the four variables for each position / corner on the screen and then with each loop just reduce each variable value by a specified amount ( say 50 pixels ) and then do the loop again causing the box to become small on each loop until it reaches the middle. What I don't know is how to do it or express it :bike::oops:

2. How do I make the mouse go a constant speed. I am finding that the speed of the mouse starts off good then slows as it reaches it's destination in the corner. This is not what I want, I would like it to stay one speed for one side / width then speed up by a percentage / specified value.

Thanks for any help.

Again please don't just slap some code down :) as just getting the code will not help me learn how to do it.

:( Neoborn :D

Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites



TopLeftx,y would be $TLx $TLy

TopRight as above $TRx $TRy

Bottom would be $BLx $BLy etc

So, each time round the loop you deduct the 50 pixels.

HTH


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

TopLeftx,y would be $TLx $TLy

TopRight as above $TRx $TRy

Bottom would be $BLx $BLy etc

So, each time round the loop you deduct the 50 pixels.

HTH

How is that different from what I have?


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

this is just an answer to number 2 this does a user32.dll call so the mouse gets there instally

http://www.autoitscript.com/forum/index.php?showtopic=21440

Can I control speed with that as getting there instantly wasn't the problem with MouseMove() it was that it moves at a given speed then starts to slow at about 3 inches from it's intended destination. Anyway to make it move at a given speed the whole way then just stop?


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

Can I control speed with that as getting there instantly wasn't the problem with MouseMove() it was that it moves at a given speed then starts to slow at about 3 inches from it's intended destination. Anyway to make it move at a given speed the whole way then just stop?

MouseMove ( x, y [, speed] )

From the helpfile:

[optional] the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Ahhhhhhhhhhhhhhhhhhhhhh. Maybe my engrish is fcuked. For some reason people aren't getting what I am saying.

I do not want to get the mouse there instantly. What I would like to do is have a constant speed. :(. Please try it so you know what I am talking about. You will see that the mouse starts to slow at the destination.

Thanks though :)


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

Ahhhhhhhhhhhhhhhhhhhhhh. Maybe my engrish is fcuked. For some reason people aren't getting what I am saying.

I do not want to get the mouse there instantly. What I would like to do is have a constant speed. :(. Please try it so you know what I am talking about. You will see that the mouse starts to slow at the destination.

Thanks though :)

Oh!, sorry.. :D


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Oh!, sorry.. :)

I would move the mouse with a speed of zero an increment the X,Y co-ords within a loop, this should get a constant speed.


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Ahhhhhhhhhhhhhhhhhhhhhh. Maybe my engrish is fcuked. For some reason people aren't getting what I am saying.

I do not want to get the mouse there instantly. What I would like to do is have a constant speed. :(. Please try it so you know what I am talking about. You will see that the mouse starts to slow at the destination.

Thanks though :)

Lol i understand your problem thats why i said to use that UDF because you wont have to worry about the mouses speed

Share this post


Link to post
Share on other sites

But I want to worry about the speed :). If you read the pseudocode section it states that the programs mouse speed will pick up each loop / complete circuit round the screen. Yes it will increment and get faster.

From now on NO INSTANT discussions !!! :(:D You're all banned from saying the word instant!


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

But I want to worry about the speed :). If you read the pseudocode section it states that the programs mouse speed will pick up each loop / complete circuit round the screen. Yes it will increment and get faster.

From now on NO INSTANT discussions !!! :(:oops: You're all banned from saying the word instant!

So, instead of adding +1 to the X co-ord during the loop you add +2 or +5 or whatever...

Notice, I never used the word Instant... :D

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

1. I know there is a way to make the four variables for each position / corner on the screen and then with each loop just reduce each variable value by a specified amount ( say 50 pixels ) and then do the loop again causing the box to become small on each loop until it reaches the middle. What I don't know is how to do it or express it :)

Does it look like the way I am currently doing this is the most efficient way of doing it?

Bueller? Bueller?

Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

1. I know there is a way to make the four variables for each position / corner on the screen and then with each loop just reduce each variable value by a specified amount ( say 50 pixels ) and then do the loop again causing the box to become small on each loop until it reaches the middle. What I don't know is how to do it or express it :)

Does it look like the way I am currently doing this is the most efficient way of doing it?

Bueller? Bueller?

You did that in the demo script you provided??

Which part of this are you having problem with?, making the mouse spiral in with a box movement or changing the speed?


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Yah this part:

;~   $PN = $PN + $PN
;~   $PM = $PM + $PM
;~   $DWPN = $DWPN - $PN
;~   $DHPN = $DHPN - $PN
;~   $MS = $MS - 30

I can change the speed because I know the speed goes from 0 - 100. Have you ever used MouseMove? Try taking the one line

Local $DW = @DesktopWidth, $DH = @DesktopHeight, $CMP = MouseGetPos(), $MS = 100, $PM = 100, $PN = 50, $DWPN = $DW - $PN, $DHPN = $DH - $PN, $DHPM = $DH - $PM

MouseMove($PN, $PN, $MS) ;starting position top left corner fifty pixels in
MouseMove($DWPN, $PN,$MS) ; top right corner fifty pixels in.

You will notice that the mouse starts to slow towards the end no?


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

Yah this part:

;~   $PN = $PN + $PN
;~   $PM = $PM + $PM
;~   $DWPN = $DWPN - $PN
;~   $DHPN = $DHPN - $PN
;~   $MS = $MS - 30

I can change the speed because I know the speed goes from 0 - 100. Have you ever used MouseMove? Try taking the one line

Local $DW = @DesktopWidth, $DH = @DesktopHeight, $CMP = MouseGetPos(), $MS = 100, $PM = 100, $PN = 50, $DWPN = $DW - $PN, $DHPN = $DH - $PN, $DHPM = $DH - $PM

MouseMove($PN, $PN, $MS) ;starting position top left corner fifty pixels in
MouseMove($DWPN, $PN,$MS) ; top right corner fifty pixels in.

You will notice that the mouse starts to slow towards the end no?

I`ve tried to describe this here, so heres a bit of code for you to try...

HotKeySet("{ESC}", "_exit")
For $Stp = 10 to 100 step 5
    For $x = 0 to 800 step $Stp
        mousemove($x,500,0)
    next
    For $x =800 to 0 step -$Stp
        mousemove($x,500,0)
    Next
next    
Func _exit()
    Exit
EndFunc

2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Will read this code for a bit to gain understanding ...I love it lol very funny it was too but yes exactly! spot on matey!


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

hey maybe this can help, its not a square but its close, lol

http://www.autoitscript.com/forum/index.ph...ndpost&p=146206


[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 this post


Link to post
Share on other sites

How do I go through a loop and then increase a variable by a specific value but not until it has done the first loop for example

$v = 10

first loop = 10

then at end of loop

$v = $v + $v

I sux at explaining what I am trying to do :)


~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Share this post


Link to post
Share on other sites

reversly

$v = 0

$add = 10

then at top of loop

$v = $v + $add

first loop = 10

8)


NEWHeader1.png

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