Can I make my script randomly pick between a few specified MouseMove points and then move to it?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Hampoon
Posts: 25
Joined: 19 Oct 2018, 22:04

Can I make my script randomly pick between a few specified MouseMove points and then move to it?

13 Dec 2018, 13:06

Hey there. I'd like to write a script that will click on a random button. The screen will just have a webpage up with several buttons, and I can specify the locations of those buttons then the script will randomly decide one of them and move to it (then click it.). Is this at all possible?

Oh, also, on a sidenote, for this script a handy thing would be to see if it could do something like ctrl+f on and find something, then if it found a result such as, "Wow, that really sucked." it would do something like ctrl+w (just close the tab). If it didn't find that, however, it would do ctrl+t and repeat the previous code a couple times.

So yeah. Any help to a noob like me would be greatly appreciated. :P
I'm pretty new to this language and barely know what I'm doing. Please excuse any stupidity lol.
Oh also try and explain stuff well if I need it :P
User avatar
sinkfaze
Posts: 616
Joined: 01 Oct 2013, 08:01

Re: Can I make my script randomly pick between a few specified MouseMove points and then move to it?

13 Dec 2018, 15:13

If you just want to select one out of, say, five buttons, you can "label" the buttons and use Random to select which one to click each time:

Random, btn, 1,5
Hampoon
Posts: 25
Joined: 19 Oct 2018, 22:04

Re: Can I make my script randomly pick between a few specified MouseMove points and then move to it?

14 Dec 2018, 12:47

sinkfaze wrote:
13 Dec 2018, 15:13
If you just want to select one out of, say, five buttons, you can "label" the buttons and use Random to select which one to click each time:

Random, btn, 1,5
Cool! How do I "label" them though?
I'm pretty new to this language and barely know what I'm doing. Please excuse any stupidity lol.
Oh also try and explain stuff well if I need it :P
User avatar
sinkfaze
Posts: 616
Joined: 01 Oct 2013, 08:01

Re: Can I make my script randomly pick between a few specified MouseMove points and then move to it?

14 Dec 2018, 16:18

Hampoon wrote:
14 Dec 2018, 12:47
How do I "label" them though?
You could put all of the button names (or IDs or whatever you use) into an array and use random to pick which value you'll send.

This is not working code, just visualization of the concept.

Code: Select all

btns :=	["btnOne","btnTwo","btnThree","btnFour","btnFive"]

...

Random, n, 1, 5
pwb.document.getElementsByTagName(btns[n]).click()

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: NinjoOnline and 295 guests