Random number entry, help request.

Advanced programming using WinTask scripting language

Random number entry, help request.

Postby Richie0427 on Sun Oct 11, 2015 3:04 am

Hello, I am trying to get a random 6 digit number generated to be input into website.

I have the script set up, just cant figure out how to make it enter a random 6 digit number.

I would like to loop this script,. and enter a new 6 digit number each time it runs. Is that possible, and can anyone help me .

thank you kindly


StartBrowser("CH", "https://www.yoursite.com/support/web/report", 3)

UsePage("xxxxx - Player Report")
SelectHTMLItem("SELECT[NAME='game']", "Gamer")
WriteHTML("INPUT NUMBER[NAME='user_id']", "123456") <~~~~~~~~line that would like to random generate 6 digits
SelectHTMLItem("SELECT[NAME='category']", "Free Play")
WriteHTML("INPUT TEXT[NAME='reported_player']", "22386382")
ClickHTMLElement("DIV[ID='kx_nav_bar']")
ClickHTMLElement("DIV[ID='kx_nav_bar']")
WriteHTML("TEXTAREA[NAME='description']", "Thank you ")
ClickHTMLElement("DIV[OUTERTEXT='Submit']")


Pause 5 secs



CloseWindow("CHROME.EXE|Chrome_WidgetWin_1|xxxxxx - Player Report - Google Chrome",1)

until 1=2
Richie0427
 
Posts: 2
Joined: Sun Oct 11, 2015 2:58 am

Re: Random number entry, help request.

Postby Richie0427 on Sun Oct 11, 2015 3:06 am

[code

StartBrowser("CH", "https://www.yoursite.com/support/web/report", 3)

UsePage("xxxxxx - Player Report")
SelectHTMLItem("SELECT[NAME='game']", "gamer")
WriteHTML("INPUT NUMBER[NAME='user_id']", "123456")
SelectHTMLItem("SELECT[NAME='category']", "Suspected Cheater")
WriteHTML("INPUT TEXT[NAME='reported_player']", "22386382")
ClickHTMLElement("DIV[ID='kx_nav_bar']")
ClickHTMLElement("DIV[ID='kx_nav_bar']")
WriteHTML("TEXTAREA[NAME='description']", "Thank you ")
ClickHTMLElement("DIV[OUTERTEXT='Submit']")


Pause 5 secs



CloseWindow("CHROME.EXE|Chrome_WidgetWin_1|xxxxx - Player Report - Google Chrome",1)

until 1=2

][/code]
Richie0427
 
Posts: 2
Joined: Sun Oct 11, 2015 2:58 am

Re: Random number entry, help request.

Postby TechSupport on Sun Oct 11, 2015 10:22 am

Hello,
Random(9) returns a random number between 0 and 9, and str$ converts this number to a string, so here is the code:
a$=str$(random(9))+str$(random(9))+str$(random(9))+str$(random(9))+str$(random(9))+str$(random(9))
msgbox(a$)

and you can use a$ in WriteHTML:
WriteHTML("INPUT NUMBER[NAME='user_id']", a$)

Regards.
WinTask Tech Support
TechSupport
 
Posts: 805
Joined: Thu Nov 16, 2006 9:58 am


Return to Scripts programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron