Jump to content
Sign in to follow this  
OrganizedChaos

[HELP] Random number generator

Recommended Posts

OrganizedChaos

Hello! I am new here. I need a program which generates a number containing 10 digits. Then it has to put them in a box, on a site which requires log-in. That means i need to make 2 boxes for username and password.I don't want that the program opens a browser!

If i am already logged on a browser like mozilla firefox, this script i made is working :

ShellExecute("https://censored")
sleep(9000)
MouseClick("left", 900, 520, 1, 2)
sleep(100)
MouseClick("left", 900, 520, 1, 2)
sleep(100)
Global $sRandom
For $i = 1 to 10
$sRandom &= Random(0,9,1)
next
Send($sRandom)
sleep(100)
Send("{ENTER}")

It opens the browser, then enters the number in the right box and presses enter. But i want it to do same thing without opening the browser and moving the mouse. I want it to connect to the site and enter the random number. I also want it to do this until i stop it.

An example of a program which does something similar is : Posted Image

As you can see, you can log in, then it connects to a site, where it does some clicks. I want same thing but to generate a random number and to put it in a box on that site.

I hope you understand me and you can help me.

Any code or part of a code will be appreciated!

Thx in advance!

Share this post


Link to post
Share on other sites
PsaltyDS

Look in the help file at the _IE* functions of the IE.au3 UDF. There are examples for setting values and clicking things in an IE browser.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
OrganizedChaos

You didn't understand! I don't want it to open the browser and to use the mouse to click! I want it to work "in background", so i can work with other processes till it enters the random numbers!

Share this post


Link to post
Share on other sites
PsaltyDS

You didn't understand! I don't want it to open the browser and to use the mouse to click! I want it to work "in background", so i can work with other processes till it enters the random numbers!

You didn't even bother to crack open the help file, did you...? :P

If you ever decide to do so, perhaps you'll come across things like $f_visible = 0.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
OrganizedChaos

I tried with

$oIE = _IECreate ("http://site.com", 0, 0)

but it is not what i want. This code shows me the window. I don't want to see the window. By the way, how can i do the log-in thingy?

Share this post


Link to post
Share on other sites
PsaltyDS

I tried with

$oIE = _IECreate ("http://site.com", 0, 0)

but it is not what i want. This code shows me the window. I don't want to see the window. By the way, how can i do the log-in thingy?

That will not show the browser you opened with _IECreate(), but if there are pop up dialogs coming from that page, then you would have to catch them as they occurred and hide them as a separate process. As for log in dialogs, review the example scripts in the help file for _IEFormElementSetValue().

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
OrganizedChaos

I really don't know what I'm doing wrong. Even the example script is not working :

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

It opens internet explorer and navigates to hotmail page, but it doesnt log-ing if i give my user name and password. Any idea?

Share this post


Link to post
Share on other sites
PsaltyDS

I really don't know what I'm doing wrong. Even the example script is not working :

#include <IE.au3>
; Create a browser window and navigate to hotmail
$oIE = _IECreate ("http://www.hotmail.com")

; get pointers to the login form and username, password and signin fields
$o_form = _IEFormGetObjByName ($oIE, "f1")
$o_login = _IEFormElementGetObjByName ($o_form, "login")
$o_password = _IEFormElementGetObjByName ($o_form, "passwd")
$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "your username here"
$password = "your password here"

; Set field values and submit the form
_IEFormElementSetValue ($o_login, $username)
_IEFormElementSetValue ($o_password, $password)
_IEAction ($o_signin, "click")

It opens internet explorer and navigates to hotmail page, but it doesnt log-ing if i give my user name and password. Any idea?

In general, add _IEErrorHandlerRegister() right after the include and run it in SciTE so you can see all the output. That will point in the right direction.

However, that script runs fine for me (though of course it fails to log in without a valid email user name and password).

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.