Jump to content

Need help with an registration script


Masqo
 Share

Recommended Posts

Heya, mates. Im a beginner of AutoIt, and would like to make a script which will write registration info to forms on one website after i press a F7 and then when i enter confirmation code and press Alt+a, it will press on the button to continue. I tried like this:

$username = IniRead ( "bot.ini", "Account", "user", "default" );
$email = IniRead ( "bot.ini", "Account", "email", "default" );
$password = IniRead ( "bot.ini", "Account", "password", "default" );
$SBT = IniRead ( "bot.ini", "Pageload", "SleepBeforeTab", "100" );
$sendF7 = Send("{F7}")

Sleep(1000000000000000000000000000000)

If $sendF7 = 1 Then
Sleep(100)
TrayTip("bot v1.1", "Entering username", 10, 1)
MouseClick("left", 100, 300, 1)
Sleep($SBT)
Send("{TAB}")
Sleep($SBT)
Send($username)
TrayTip("bot v1.1", "Entering password", 10, 1)
Send("{TAB}")
Sleep($SBT)
Send($password)
TrayTip("bot v1.1", "Entering password again", 10, 1)
Send("{TAB}")
Sleep($SBT)
Send($password)
TrayTip("bot v1.1", "Entering an e-mail", 10, 1)
Send("{TAB}")
Sleep($SBT)
Send($email)
TrayTip("bot v1.1", "Checkbox #1!", 10, 1)
Sleep($SBT)
MouseClick("left", 455, 590, 1)
TrayTip("bot v1.1", "Checkbox #2!", 10, 1)
Sleep($SBT)
MouseClick("left", 455, 610, 1)
TrayTip("bot v1.1", "Checkbox #3!", 10, 1)
Sleep($SBT)
MouseClick("left", 455, 630, 1)
TrayTip("bot v1.1", "Your turn now! Enter the confirmation code and press ALT+a", 10, 1)
Sleep($SBT)
MouseClick("left", 455, 525, 1)
EndIf


If Send("!a") Then
Sleep($SBT)
MouseClick("left", 500, 675, 1)
EndIf

But it didnt work... If i press F7, nothing happens. Is there any way to start the script, script will wait in background and if i press F7, the main script starts and writes information to registration forms and after that stops for me to write confirmation key and after i press alt+a, it will press on continue button. Please help me :lmao:

BTW, this script is for my own use only, just pleaase help me to get it to work. It will make my website making a little bit easier. :P

Edited by Masqo
Link to comment
Share on other sites

You need to have it be a HotKey and not if function call. That script is not even workable but it is a nice try :P Please look in the help file for HotKeySet and it will tell you what you need.

Here is what I think you are looking for:

HotKeySet("{F7}", "_Run")
HotKeySet("!a", "_Exit")
While 1
    Sleep(100)
WEnd
Func _Run()
    $username = IniRead("bot.ini", "Account", "user", "default");
    $email = IniRead("bot.ini", "Account", "email", "default");
    $password = IniRead("bot.ini", "Account", "password", "default");
    $SBT = IniRead("bot.ini", "Pageload", "SleepBeforeTab", "100");
    Sleep(100)
    TrayTip("bot v1.1", "Entering username", 10, 1)
    MouseClick("left", 100, 300, 1)
    Sleep($SBT)
    Send("{TAB}")
    Sleep($SBT)
    Send($username)
    TrayTip("bot v1.1", "Entering password", 10, 1)
    Send("{TAB}")
    Sleep($SBT)
    Send($password)
    TrayTip("bot v1.1", "Entering password again", 10, 1)
    Send("{TAB}")
    Sleep($SBT)
    Send($password)
    TrayTip("bot v1.1", "Entering an e-mail", 10, 1)
    Send("{TAB}")
    Sleep($SBT)
    Send($email)
    TrayTip("bot v1.1", "Checkbox #1!", 10, 1)
    Sleep($SBT)
    MouseClick("left", 455, 590, 1)
    TrayTip("bot v1.1", "Checkbox #2!", 10, 1)
    Sleep($SBT)
    MouseClick("left", 455, 610, 1)
    TrayTip("bot v1.1", "Checkbox #3!", 10, 1)
    Sleep($SBT)
    MouseClick("left", 455, 630, 1)
    TrayTip("bot v1.1", "Your turn now! Enter the confirmation code and press ALT+a", 10, 1)
    Sleep($SBT)
    MouseClick("left", 455, 525, 1)
EndFunc;==>Run
Func _Exit()
    Sleep($SBT)
    MouseClick("left", 500, 675, 1)
      ;Exit
EndFunc;==>Exit

Hope this works or helps you.

AutoIt Smith

Edited by AutoIt Smith
Link to comment
Share on other sites

What you mean its not workable? :S It is impossible to get to work? Sorry im a newbie :P But thx for great reply, im smarter now :lmao:

EDIT: If i tried to run this script, i got an error:

Line 40(File "C:\......\bot.au3"):

Func run()

Error: Badly formatted "Func" statement.

Edited by Masqo
Link to comment
Share on other sites

Yes, You cannot if Send("!a") = 1 then run. Send is a parameter that will type text to the active window. It will return 1 on success. This means it MUST be sent using send. This is proper use:

$Send = Send("!a")
If $Send = 1 Then 
   MsgBox(0, $Send, "Success")
Else
   MsgBox(0, $Send, "Failure")
EndIf

A HotKey (or the _IsPressed function) will determine if the user has pressed a certain key and will do something (function or script) according to what key someone pressed. For example"

HotKeySet("{F1}", "F1")
HotKeySet("{F1}", "F2")
While 1
   Sleep(100)
WEnd
Func F1()
   MsgBox(0, @ScriptName, "You pressed F1 !")
EndFunc
Func F2()
   MsgBox(0, @ScriptName, "You pressed F2 !")
EndFunc

Is pressed is slightly different and does not bind the key and is a more advanced function.

#include <Misc.au3>
While 1
   If _IsPressed('0D') = 1 Then 
    ; If Enter Was Pressed
      MsgBox(0, @ScriptName, "You pressed enter which is the hex key 0D !")
   EndIf
WEnd

I hope you can understand how the return structure works :P

Also sorry for the error, recopy the script and run it. You cannot create a function that corrisponds to another AutoIt function. For example, Run is an AutoIt native function and Func Run .... EndFunc would override that so it was badly formatted. Hope you understand, I made that script just as an example, not a working example.

Edited by AutoIt Smith
Link to comment
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
 Share

  • Recently Browsing   0 members

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