Sign in to follow this  
Followers 0
MrBlack

what's wrong here? pls help

10 posts in this topic

#1 ·  Posted (edited)

FIRST OF ALL "DO NOR RUN THIS SCRIPT"

i did something wrong becouse when i run it i cant stop it

not even pause it. all i want is to run the script whitout starting to move mouse untill i press "Page Up" and then to stop/pause

script from "page Up" too, this one do the following:

run ok

press page up its start ok

i need to pause/stop fail

tnx in advance

source:

HotKeySet("{PGUP}", "_MyFunc")

Global $MyFuncRun = 0

While 1

Sleep(100)

WEnd

Func _MyFunc()

$MyFuncRun = Not $MyFuncRun

While 1

If Not $MyFuncRun Then Return

For $i=1 To 50

Sleep(0)

MouseDown("Right")

MouseMove (Random(0, 1023), Random(0, 490))

MouseUp("Right")

Sleep(Random(0, 0))

Next

WEnd

EndFunc

Func TogglePause()

$Paused = Not $Paused

While $Paused

Sleep(100)

WEnd

EndFunc

Edited by MrBlack

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

FIRST OF ALL "DO NOR RUN THIS SCRIPT"

i did something wrong becouse when i run it i cant stop it

not even pause it. all i want is to run the script whitout starting to move mouse untill i press "Page Up" and then to stop/pause

script from "page Up" too, this one do the following:

run ok

press page up its start ok

i need to pause/stop fail

tnx in advance

source:

CODE
HotKeySet("{PGUP}", "_MyFunc")

Global $MyFuncRun = 0

While 1

Sleep(100)

WEnd

Func _MyFunc()

$MyFuncRun = Not $MyFuncRun

While 1

If Not $MyFuncRun Then Return

For $i=1 To 50

Sleep(0)

MouseDown("Right")

MouseMove (Random(0, 1023), Random(0, 490))

MouseUp("Right")

Sleep(Random(0, 0))

Next

WEnd

EndFunc

Func TogglePause()

$Paused = Not $Paused

While $Paused

Sleep(100)

WEnd

EndFunc

Your For/Next loop is just getting in the way of testing the $MyFuncRun variable for when to quit. Your use of Sleep() was... odd. Also, your TogglePause() is never used. This tests OK for me:

HotKeySet("{PGUP}", "_MyFunc")
Global $MyFuncRun = 0

While 1
    Sleep(100)
WEnd

Func _MyFunc()
    $MyFuncRun = Not $MyFuncRun
    While 1
        If Not $MyFuncRun Then Return
        MouseDown("Right")
        MouseMove(Random(0, 1023), Random(0, 490))
        MouseUp("Right")
        Sleep(Random(10, 1000, 1)) ; Sleep random time from 10ms to 1s
    WEnd
EndFunc   ;==>_MyFunc

:)

Edit: Hrumph... the other bald guy beat me to it!

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

lol, its embarasing for me.

tnx ppl.

Edited by MrBlack

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

tnx alot ppl,

but...... :)

i need now the mouse to move in that area very very fast,

i didnt find a way to do that.

can u give me a hint?

tnx in advance

Edited by MrBlack

Share this post


Link to post
Share on other sites

tnx alot ppl,

but...... :P

i need now the mouse to move in that area very very fast,

i didnt find a way to do that.

can u give me a hint?

tnx in advance

Read the helpfile on MouseMove(), the speed of movement is an optional parameter and speed 0 jumps instantly.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thats what i do but...

look at my script, it moves with same speed:

HotKeySet("{PGUP}", "_MyFunc")

Global $MyFuncRun = 0

While 1

;Sleep(0);

WEnd

Func _MyFunc()

$MyFuncRun = Not $MyFuncRun

While 1

If Not $MyFuncRun Then Return

MouseDown("Right")

MouseMove(Random(212, 788, 1), Random(84, 520, 1))

MouseUp("Right")

;Sleep(Random(0, 0, 0)) ; Sleep random time from 10ms to 1s;

WEnd

EndFunc ;==>_MyFunc

;( x, y [, speed] );

;(700, 700, 0);

Edited by MrBlack

Share this post


Link to post
Share on other sites

can u tell me the last 0 what it is?

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

MouseMove ( x, y [, speed])

Parameters

x The screen x coordinate to move the mouse to.

y The screen y coordinate to move the mouse to.

speed [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.

The last 0 determines how fast the mouse pointer snaps to that position. If it is 100 it will move very slowly across the screen until it reaches the point that it has selected. If it is a 0 then it does it instantly. Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

tnx ppl, now i know to make a simple script, but the fact is i start to enjoy

this thing. and tnx to Autoit team too for this program

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

back again :lmao:

this is what i have:

HotKeySet("{PGUP}", "_MyFunc")

Global $MyFuncRun = 0

While 1

;Sleep(0);

WEnd

Func _MyFunc()

$MyFuncRun = Not $MyFuncRun

While 1

If Not $MyFuncRun Then Return

MouseDown("Right")

;MouseMove(Random(212, 788, 1), Random(84, 520, 1) 0);

;MouseMove(Random(212, 788, 1), Random(84, 520, 1),2);

MouseMove(Random(297, 734, 1), Random(145, 308, 1),2)

MouseUp("Right")

;Sleep(Random(0, 0, 0)) ; Sleep random time from 10ms to 1s;

WEnd

EndFunc ;==>_MyFunc

;( x, y [, speed] );

;(700, 700, 0);

;MouseMove(Random(212, 788, 1), Random(84, 520, 1),0);

its work fine but... i want to add a new function:

for example, to press key "1" sleep 110 seconds, press key "2" sleep 5 sec and repeat, and to do this "1" "2" switch when i press "page up" key like the rest of the script, and stop same time.

i have try with:

send("{1}")

sleep(110000)

send("{2}")

sleep(5000)

but this ruin my all script, becouse sleep occure in clicker too an i dont want this

tnx in advance

Edited by MrBlack

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