Jump to content

Recommended Posts

Posted (edited)

i have 2 coordinates in my INI file, and i want the script to click randomly within this area

[Pixel]
topleft = 10,10 ;;;; topleft parameter
bottomright = 30,30;;;;; bottomright parameter

so i want it to click randomly within this region

i don't want it to be a set number of clicks with set coordinates, cuz the parameter will change

so i was thinking: but not sure if this is the best way.

$Click = IniReadSection("data.ini", "pixel")

$RandomX = random( $click[1][1] , $click[2][1] )
$RandomY = random( $click[1][2] , $click[2][2] )

mouseclick("left", $RandomX , $RandomY)

i get a error in this thing...

Edited by DNnlee
Posted

  sandin said:

search RANDOM function from help files, using this function you can set min random, and max. random number (which can be read from your ini file).

yea thats what i did.... forgot i left out the word random between the varaible.. ooops

i'll try again

Posted

here's an example code:

#include <GUIConstants.au3>
Opt("MouseCoordMode", 2)
$x = 600
$y = 450
$speed = 250; 0 = fastest
$Form1 = GUICreate("AForm1", $x, $y, 200, 120)
$Button1 = GUICtrlCreateButton("Random Click", 8, 416, 113, 25, 0)
$Label1 = GUICtrlCreateLabel("Coordinates: X, Y", 150, 423, 200)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            $randomX = Random(0, $x, 1)
            $randomY = Random(0, $y, 1)
            GUICtrlSetData($Label1, "Coordinates: " & $randomX & ", " & $randomY)
            MouseClick("Left", $randomX, $randomY, 1, $speed)
    EndSwitch
WEnd

and you can make your script to read $x and $y variables from ini file ;p

Posted

  sandin said:

here's an example code:

#include <GUIConstants.au3>
Opt("MouseCoordMode", 2)
$x = 600
$y = 450
$speed = 250; 0 = fastest
$Form1 = GUICreate("AForm1", $x, $y, 200, 120)
$Button1 = GUICtrlCreateButton("Random Click", 8, 416, 113, 25, 0)
$Label1 = GUICtrlCreateLabel("Coordinates: X, Y", 150, 423, 200)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        case $Button1
            $randomX = Random(0, $x, 1)
            $randomY = Random(0, $y, 1)
            GUICtrlSetData($Label1, "Coordinates: " & $randomX & ", " & $randomY)
            MouseClick("Left", $randomX, $randomY, 1, $speed)
    EndSwitch
WEnd

and you can make your script to read $x and $y variables from ini file ;p

ooOoOOoO

i like it, thx... i'll play around with it

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...