Add a randon number at mouse pos.

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Steel
Newbie
Posts: 1
Joined: Tue Nov 07, 2017 1:46 pm

Add a randon number at mouse pos.

Post by Steel » Tue Nov 07, 2017 1:53 pm

Hi,

I made a script for a website to automatically search for criteria, but i need to add a random number in a specific price range.

Lets say i need to search between $3500 and 4000$, so this is my range where the number need to be randomized. (The website gets faster results if i change number between searches.)

How do i get this done? Now im clicking on the position where i need to enter (typ) the number, but i do it with the press command and its not random. I'll post part of script below.

Thank you in advanced, and sorry for my bad english.

Code: Select all

FindImagePos>%BMP_DIR%\image_2.bmp,SCREEN,0.7,4,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LDblClick
  Wait>0.100
Endif

//Max bid
CapsOff
Press NP3
Press NP5
Press NP0 * 2
Wait>0.100

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Add a randon number at mouse pos.

Post by Marcus Tettmar » Tue Nov 07, 2017 3:06 pm

Use the Random function to get a random number between 0 and 500, then add that to 3500 so that you have a random number between 3500 and 4000. Then send that number to the field using the Send command:

Code: Select all

Random>500,randNumber
Let>randPrice=randNumber+3500
Send>randPrice
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts