Jump to content
Sign in to follow this  
zamzam27

simple problem simple solution

Recommended Posts

zamzam27

sorry stupid question and really simple answer but whats wrong with this code?

Func start

HotKeySet("c", click)

$x=-1

Func click()

$x=$x*-1

endfunc

while $x=1

MouseClick("left",740, 400, 1,1000)

Wend

EndFunc

trying to make it click rapidly when i press c and stop clicking when i press c again

Share this post


Link to post
Share on other sites
dantay9

Make sure you use code \code tags when posting code.

You have a few problems. Firstly, you can't have a function within a function. Take a look at this code.

;set the hotkey so when you press c, click() is called
HotKeySet("c", "click")

;make a variable and set it to false
$x = False

;wait until x is true which means c was pressed
Do
Until $x = True

;while x is true, click in a spot on the screen
While $x = True
    MouseClick("left", 740, 400, 1, 1000)
WEnd

Func click()
    ;make x equal to the opposite of what it was
    $x = Not $x
EndFunc ;==>click
Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
zamzam27

Make sure you use code \code tags when posting code.

You have a few problems. Firstly, you can't have a function within a function. Take a look at this code.

;set the hotkey so when you press c, click() is called
HotKeySet("c", "click")

;make a variable and set it to false
$x = False

;wait until x is true which means c was pressed
Do
Until $x = True

;while x is true, click in a spot on the screen
While $x = True
    MouseClick("left", 740, 400, 1, 1000)
WEnd

Func click()
    ;make x equal to the opposite of what it was
    $x = Not $x
EndFunc ;==>click

thanks

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  

×