Jump to content

Read from .ini and type the text!


qwee
 Share

Recommended Posts

Hi!

Don't know if there is any guide for this, havn't search so much on this site for this but, well well!

I'm working on a login program for a game. And I want the program to read what's behind 'AccountName=' in the .ini file!

I've got like this:

Login Code:

func Login()
Mouseclick("left",610,428)
Sleep(300)
Send ( "ACCOUNTNAME" ); Inputs "Accountname"
Mouseclick("left",610,468)
Sleep(300)
Send ( "PASSWORD1" ); Inputs "Password1"
Mouseclick("left",610,508)
Sleep(300)
Send ( "PASSWORD2" ); Inputs "Password2"
Sleep(300)
Mouseclick("left",610,550)
Sleep(3000)
Mouseclick("left",590,185,2,50)
EndFunc

And the .ini file looks like this:

[Login]
AccountName=ACCOUNTNAME
AccountPass1=PASSWORD1
AccountPass2=PASSWORD2

How do I get it to read the settings (accountname, password 1 & 2) from 'Settings.ini' and then type out the result?

Fast help plz!

Link to comment
Share on other sites

Hi!

Don't know if there is any guide for this, havn't search so much on this site for this but, well well!

I'm working on a login program for a game. And I want the program to read what's behind 'AccountName=' in the .ini file!

I've got like this:

Login Code:

func Login()
Mouseclick("left",610,428)
Sleep(300)
Send ( "ACCOUNTNAME" ); Inputs "Accountname"
Mouseclick("left",610,468)
Sleep(300)
Send ( "PASSWORD1" ); Inputs "Password1"
Mouseclick("left",610,508)
Sleep(300)
Send ( "PASSWORD2" ); Inputs "Password2"
Sleep(300)
Mouseclick("left",610,550)
Sleep(3000)
Mouseclick("left",590,185,2,50)
EndFunc

And the .ini file looks like this:

[Login]
AccountName=ACCOUNTNAME
AccountPass1=PASSWORD1
AccountPass2=PASSWORD2

How do I get it to read the settings (accountname, password 1 & 2) from 'Settings.ini' and then type out the result?

Fast help plz!

Maybe you could try this:

FileReadLine("Settings.ini", 3)

You store the result in a variable and then with some string function remove the part you don't like.

Read a little on file, because you'll have to open and close it.

I Hope this help you get started.

Link to comment
Share on other sites

I think this is how you would do it! sorry if incorrect, im still a noobie! :P

$Settingsfile = @ScriptDir & "\settings.ini"

$AccountName = IniRead($Settingsfile, "Login", "AccountName", "ERROR")  
$AccountPass1 = IniRead($Settingsfile, "Login", "AccountPass1", "ERROR") 
$AccountPass2 = IniRead($Settingsfile, "Login", "AccountPass2", "ERROR")

Then change

Send ($AccountName ); Inputs "Accountname"
Mouseclick("left",610,468)
Sleep(300)
Send ($AccountPass1 ); Inputs "Password1"
Mouseclick("left",610,508)
Sleep(300)
Send ($AccountPass2 ); Inputs "Password2"
Link to comment
Share on other sites

I think this is how you would do it! sorry if incorrect, im still a noobie! :P

$Settingsfile = @ScriptDir & "\settings.ini"

$AccountName = IniRead($Settingsfile, "Login", "AccountName", "ERROR")  
$AccountPass1 = IniRead($Settingsfile, "Login", "AccountPass1", "ERROR") 
$AccountPass2 = IniRead($Settingsfile, "Login", "AccountPass2", "ERROR")

Then change

Send ($AccountName ); Inputs "Accountname"
Mouseclick("left",610,468)
Sleep(300)
Send ($AccountPass1 ); Inputs "Password1"
Mouseclick("left",610,508)
Sleep(300)
Send ($AccountPass2 ); Inputs "Password2"

THX! <3 :unsure: It worked ;D

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...