Sign in to follow this  
Followers 0
Alexxander

Need easy help

7 posts in this topic

hi all 
i was watching this vid


Share this post


Link to post
Share on other sites



A few things wrong here.

First, the reason it isn't working at all is because "(up)" should be "{up}". Note the curly brackets.  The rest of the arrow keys should also use curly brackets.

Now the script should be working, but not correctly... you'll notice the mouse moves in unexpected ways.  This is because you have confused $pos[1] vs $pos[0] in both the left and right functions.

HotKeySet("{UP}", "up")
HotKeySet("{DOWN}", "down")
HotKeySet("{RIGHT}", "right")
HotKeySet("{LEFT}", "left")

While 1
    Sleep(10)
WEnd

Func up()
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] - 1, 1)
EndFunc ;==>up

Func down()
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] + 1, 1)
EndFunc ;==>down

Func right()
$pos = MouseGetPos()
MouseMove($pos[0] + 1, $pos[1], 1)
EndFunc ;==>right

Func left()
$pos = MouseGetPos()
MouseMove($pos[0] - 1, $pos[1], 1)
EndFunc ;==>left
1 person likes this

Share this post


Link to post
Share on other sites

 

A few things wrong here.

First, the reason it isn't working at all is because "(up)" should be "{up}". Note the curly brackets.  The rest of the arrow keys should also use curly brackets.

Now the script should be working, but not correctly... you'll notice the mouse moves in unexpected ways.  This is because you have confused $pos[1] vs $pos[0] in both the left and right functions.

HotKeySet("{UP}", "up")
HotKeySet("{DOWN}", "down")
HotKeySet("{RIGHT}", "right")
HotKeySet("{LEFT}", "left")

While 1
    Sleep(10)
WEnd

Func up()
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] - 1, 1)
EndFunc ;==>up

Func down()
$pos = MouseGetPos()
MouseMove($pos[0], $pos[1] + 1, 1)
EndFunc ;==>down

Func right()
$pos = MouseGetPos()
MouseMove($pos[0] + 1, $pos[1], 1)
EndFunc ;==>right

Func left()
$pos = MouseGetPos()
MouseMove($pos[0] - 1, $pos[1], 1)
EndFunc ;==>left

 

 

 

thank u a lot bro it worked 

but in the TUT he made it "(up)" how did it worked with him ?

another question is why we used sleep ?


Share this post


Link to post
Share on other sites

thank u a lot bro it worked 

but in the TUT he made it "(up)" how did it worked with him ?

another question is why we used sleep ?

It was curly brackets in the video as well, just hard to see it.

The sleep is there because we have an infinite loop.  I think autoit does a good job of not killing the CPU even without it there, but lets say for example that we are doing a basic calculation in that loop.  Now we are using the processor to do a basic calculation and as soon as it's done, do it again, rinse and repeat.  With no sleep in an infinite loop that does a basic calculation, we would expect one full core to get utilized because it is doing exactly what we told it to; do this as fast as you can, over and over.  With the sleep, we guarantee that we are not trying to run this as fast as possible and freeing up processor time for other programs.

1 person likes this

Share this post


Link to post
Share on other sites

thank you guys i really appreciate your help >> i <3 this forum


Share this post


Link to post
Share on other sites

BTW: Could you please give your threads a meaningful title :)
Everyone on the General Help and Support forum is seeking for help. So "Need easy help" doesn't tell us what you are looking for!

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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