Sign in to follow this  
Followers 0
Wonderbread

Click only inside of a certain window.

4 posts in this topic

Global $Paused

HotkeySet("{F6}", "TogglePause")
HotkeySet("{F5}", "Start")

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Start()
    While 1
        WinActivate("Title Removed")
        $RandomW = Random(1,700)
        $RandomH = Random(1,767)
        Sleep(5)
        MouseClick("left",$RandomW,$RandomH)
        Sleep(5)
    WEnd
EndFunc

While 1
    Sleep (1)
WEnd

That's my code so far. I'm trying to get it to only click inside of a certain window, the one thats title I've removed.

I've read through docs. but the only one I can find is ControlClick - but I don't want to click on a certain piece of text - just a random pixel within the window.

Basic info, yes.

If you need more just ask.

Share this post


Link to post
Share on other sites



Func Start()
    While 1
        WinActivate("Title Removed")
        WinWaitActive("Title Removed")
        $RandomW = Random(1,700)
        $RandomH = Random(1,767)
        Sleep(5)
        MouseClick("left",$RandomW,$RandomH)
        Sleep(5)
    WEnd
EndFunc

Also remember that those sleeps are in miliseconds and 5/1000 of a second is not very long


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Func Start()
    While 1
        WinActivate("Title Removed")
        WinWaitActive("Title Removed")
        $RandomW = Random(1,700)
        $RandomH = Random(1,767)
        Sleep(5)
        MouseClick("left",$RandomW,$RandomH)
        Sleep(5)
    WEnd
EndFunc

Also remember that those sleeps are in miliseconds and 5/1000 of a second is not very long

Cheers. Testing it now.

Thanks for the info about sleep, by the way. I've been working in python lately, only came back to Autoit a day or two ago, It's "time.sleep(Seconds)" in python.

Share this post


Link to post
Share on other sites

Cheers. Testing it now.

Thanks for the info about sleep, by the way. I've been working in python lately, only came back to Autoit a day or two ago, It's "time.sleep(Seconds)" in python.

Common transitional mistake. In AutoIt it's Sleep(5000).

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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