Valhalla Legends Forums Archive | Visual Basic Programming | Reading from a .ini

AuthorMessageTime
QwertyMonster
I want my bot to read from my .ini.

I want to create accounts but using the list from a .ini.

I tried

[code]
Dim strCompare as string

Acc1.text = right(Strcompare, 1)

[/code]

And this is my config code

[code]
Public Function OpenConfig()
Dim strCompare As String

   
Open App.Path & "\Names.ini" For Output As #1

    Print #1, "Names to make"
    ' Print #1, "Warning: Do it like this: Username-Password"
    Print #1, "Server: "
    Print #1, "CDKEY: "
    Print #1, "1st: Username:Password"

    Close #1

End Function
[/code]

And on Form_Load i want it to open that file (ive made it do that atm) and then Read the "1st: " text, and create it or whatever, then go to "2nd: " and so on. But i dont know i can make it read them all. I can only get it read ONE  :-\

Help please? :-*
March 12, 2005, 2:18 PM
Quarantine
Look into these API's

[code]
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long


Public Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
[/code]
March 12, 2005, 2:36 PM
Archangel
[code]
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long

Public Function GetFromIni(AppName As String, Key As String, File As String) As String
Dim Default As String, Size As Integer, Value As Long
Dim User As String
User = Space$(128)
Size = Len(User)
Default = ""
Value = GetPrivateProfileString(AppName, Key, Default, User, Size, File)
User = Mid(User, 1, InStr(User, Chr(0)) - 1)
GetFromIni = User
End Function
[/code]

For calling function:

Config.ini:

[Configuration]
Username=Dan
Password=Owns

[code]
Username = GetFromIni("Configuration", "Username", "C:\Config.ini")
Password = GetFromIni("Configuration", "Password", "C:\Config.ini")
[/code]

[Edit: Grammar Mistakes]
March 12, 2005, 4:00 PM
KkBlazekK
Giving people code doesn't help them really.
March 12, 2005, 4:02 PM
Archangel
Well, not to hard to make though...
Want me to remove code?
March 12, 2005, 4:12 PM
BaDDBLooD
[quote author=Archangel link=topic=10896.msg103456#msg103456 date=1110643945]
Well, not to hard to make though...
Want me to remove code?
[/quote]

IMO, it would be better to give them the API call and then maybe a short description oh how it works.
March 12, 2005, 4:55 PM
QwertyMonster
[quote author=Archangel link=topic=10896.msg103456#msg103456 date=1110643945]
Well, not to hard to make though...
Want me to remove code?
[/quote]

Well i didnt copy / paste your code so i cant cheat. But if you want remove it, but if you dont, please comment it. It does help people.


Ok, so now ive got the basic jiff of it. But how would i make it stay the same every time i load it up again? Cos it just goes bk to "".

I put it to go to "", but thats the only way i can save it  :-\

Heres my code
[code]
Public Function OpenConfig()
Dim strCompare As String

   
Open App.Path & "\Names.ini" For Output As #1

    Print #1, "Names to make"
    ' Print #1, "Warning: Do it like this: Username-Password"
    Print #1, "Server: "
    Print #1, "CDKEY: "
    Print #1, "1st: Username:Password"
    Print #1, "2nd:"
    Print #1, "3rd:"
    Print #1, "4th:"
    Print #1, "5th:"
    Print #1, "6th:"
    Print #1, "7th:"
    Print #1, "8th:"
    Print #1, "9th:"
    Print #1, "10th:"
    Close #1
[/code]

See i put it to "", only way i can make it save tbh.

Can anybody help?
March 12, 2005, 8:00 PM
FrOzeN
[quote author=QwertyMonster link=topic=10896.msg103436#msg103436 date=1110637089]I want to create accounts but using the list from a .ini.[/quote]

It'd be easier to read lists from a .txt as opposed to an .ini which is better for storing all the details.
March 13, 2005, 2:29 AM
UserLoser.
[quote author=FrOzeN link=topic=10896.msg103580#msg103580 date=1110680951]
[quote author=QwertyMonster link=topic=10896.msg103436#msg103436 date=1110637089]I want to create accounts but using the list from a .ini.[/quote]

It'd be easier to read lists from a .txt as opposed to an .ini which is better for storing all the details.
[/quote]

What makes it easier to read from a file with a certain extension opposed to another?
March 13, 2005, 3:22 AM
KkBlazekK
[quote author=Warrior link=topic=10896.msg103587#msg103587 date=1110684281]
the i and n keys are close[u]r[/u] than the t and x keys :P
[/quote]



I agree with UserLoser on this one.

You should use the ini Structure if your going to save the file as a .ini
March 13, 2005, 4:11 AM
FrOzeN
Well to me it sounded like he wanted to create a accounts from a list.
And lists are normally stored in .txt's.

So inside a Accounts.txt or something he would have something like:
[quote]name1:*****
name2:*****
name3:*****
name4:*****
name5:*****
etc..[/quote]

And then a Config.ini have:
[quote][Settings]
CdKey=0000000000000
Product=PXES
Server=useast.battle.net
;etc..[/quote]

Instead of something like:

Config.ini:
[quote][Settings]
CdKey=0000000000000
Product=PXES
Server=useast.battle.net

[List]
1st=name1:*****
2nd=name2:*****
3rd=name3:*****
4th=name4:*****
5th=name5:*****
;etc..[/quote]

If Config.ini's are faster for lists why are they never used to store lists then??

[EDIT] Fixed Tags.
March 13, 2005, 6:22 AM
Quarantine
Why the hell would anyone care about speed (which is barely noticeable) when reading/writing to a file? INI is a more organized way to store information.
March 13, 2005, 6:27 AM
QwertyMonster
Ok, so now basically now i am using a .txt. Now would i read it like this:


[code]

Account1 = App.path & "\names.txt", "Names", "Acc1: "

[/code]


Something along those lines?
March 13, 2005, 10:18 AM
R.a.B.B.i.T
This should be in the VB forums and not the BotDev forums.
March 13, 2005, 2:15 PM
QwertyMonster
[quote author=rabbit link=topic=10896.msg103610#msg103610 date=1110723321]
This should be in the VB forums and not the BotDev forums.
[/quote]

Yes it should.

But does saying that help my problem? I think some people should go back and read some "News" called "Stay on topic".

Not sounding like a flame, so dont take it like one, but that was a useless Post. :-\
March 13, 2005, 2:20 PM
R.a.B.B.i.T
If the entire thread is in the wrong place, then it's off topic :)
March 13, 2005, 6:59 PM
KkBlazekK
[quote author=QwertyMonster link=topic=10896.msg103614#msg103614 date=1110723637]
that was a useless Post. :-\
[/quote]

Haha, Thats a lot coming from the king of useless posts.
March 13, 2005, 7:37 PM
QwertyMonster
[quote author=Blaze link=topic=10896.msg103640#msg103640 date=1110742647]
[quote author=QwertyMonster link=topic=10896.msg103614#msg103614 date=1110723637]
that was a useless Post. :-\
[/quote]

Haha, Thats a lot coming from the king of useless posts.
[/quote]

Oh, haha :-\
 
Now thats alot coming from the Queen of useless posts  ;)

Can we kind of... Get back on topic. Thanks.
March 13, 2005, 7:50 PM
KkBlazekK
We have already givin you everything you need, plus an example on how to use it... What more do you want?
March 13, 2005, 7:54 PM
Myndfyr
[quote author=Blaze link=topic=10896.msg103647#msg103647 date=1110743681]
We have already givin you everything you need, plus an example on how to use it... What more do you want?
[/quote]
Do it for me.

Not sounding like a flame, so don't take it like one, but that was the only logical step to go.
March 13, 2005, 8:47 PM
KkBlazekK
I wanted him to say that, or post the code that we already posted and said it doesn't work. -.-
March 13, 2005, 8:49 PM
QwertyMonster
Eh i must be blind ;D

Missed the code bit, nvm. Thanks for all help. And thx to that dxiogm person, for posting code so i can learn from it.
March 13, 2005, 9:12 PM
Quarantine
How can you miss code
March 13, 2005, 11:01 PM
QwertyMonster
[quote author=Warrior link=topic=10896.msg103691#msg103691 date=1110754901]
How can you miss code
[/quote]

No. I didnt mean i MISSED IT. But i looked through it and didnt think it was what i was looking for or needed. But i re-read it and it seems i can make it work for what i need it for. Thanks.
March 14, 2005, 2:42 PM
Grok
Does every thread have to go into arguments over too much or too little help?  You guys are almost all noobs to programming, and nearly none of you have room to be criticizing someone else who is just starting out.  Your 2-5 years experience doesn't mean jack, especially if it is not in the real world working with teams of programmers and customers on significant projects.  No school work matters, except maybe a few graduate projects (most of those don't matter).

Please stop flooding the threads with useless chest-thumping about how much code was or was not posted to other noobs.
March 14, 2005, 9:29 PM
QwertyMonster
Sworry :'(  :-*
March 14, 2005, 9:34 PM
UserLoser.
[quote author=Grok link=topic=10896.msg103833#msg103833 date=1110835757]
Does every thread have to go into arguments over too much or too little help?  You guys are almost all noobs to programming, and nearly none of you have room to be criticizing someone else who is just starting out.  Your 2-5 years experience doesn't mean jack, especially if it is not in the real world working with teams of programmers and customers on significant projects.  No school work matters, except maybe a few graduate projects (most of those don't matter).

Please stop flooding the threads with useless chest-thumping about how much code was or was not posted to other noobs.
[/quote]

I have something to say about this... but I think the lack of moderation due to some people being involved in MMORPGs too much allowed some people to think they could post what they want and it'd be ok since nobody is around to tell them otherwise.  I know I have my bad posts some places in the past, but those don't happen anymore
March 15, 2005, 1:14 AM
Adron
[quote author=UserLoser link=topic=10896.msg103862#msg103862 date=1110849297]
I have something to say about this... but I think the lack of moderation due to some people being involved in MMORPGs too much allowed some people to think they could post what they want and it'd be ok since nobody is around to tell them otherwise.  I know I have my bad posts some places in the past, but those don't happen anymore
[/quote]

Well, I have been looking at this thread, feeling the itch to split and remove posts, but neither Yoni nor DarkVirus are involved with any MMORPGs at this time as far as I know....
March 15, 2005, 1:32 PM
QwertyMonster
I have posted a bit of useless posts, and stuipid Posts. And i myself thought admins DID watch, but nothing came apon it. I shall now stop my stuipid / useless posts.
March 15, 2005, 3:44 PM
Grok
[quote author=QwertyMonster link=topic=10896.msg103925#msg103925 date=1110901478]
I have posted a bit of useless posts, and stuipid Posts. And i myself thought admins DID watch, but nothing came apon it. I shall now stop my stuipid / useless posts.
[/quote]

Some noise just isn't worth our getting involved.  But when the noise level grows very much, one of us sometimes feels compelled to moderate.  Mostly I think we all prefer that our public community has a bit of maturity, focus, self-control, and civility.  That just isn't always true.
March 15, 2005, 6:09 PM
Adron
[quote author=Grok link=topic=10896.msg103940#msg103940 date=1110910176]
Some noise just isn't worth our getting involved.  But when the noise level grows very much, one of us sometimes feels compelled to moderate.  Mostly I think we all prefer that our public community has a bit of maturity, focus, self-control, and civility.  That just isn't always true.
[/quote]

It's also worth noting that if it comes to admin moderation, it will typically end up involving banning.
March 15, 2005, 6:23 PM
KkBlazekK
[quote author=Adron link=topic=10896.msg103916#msg103916 date=1110893523]
Well, I have been looking at this thread, feeling the itch to split and remove posts, but neither Yoni nor DarkVirus are involved with any MMORPGs at this time as far as I know....
[/quote]
Well, Yoni is in the Army more then he is here and DarkVirus's Last Active time was January 11, 2005, 11:15 pm.
March 15, 2005, 7:25 PM
UserLoser.
[quote author=Adron link=topic=10896.msg103916#msg103916 date=1110893523]
[quote author=UserLoser link=topic=10896.msg103862#msg103862 date=1110849297]
I have something to say about this... but I think the lack of moderation due to some people being involved in MMORPGs too much allowed some people to think they could post what they want and it'd be ok since nobody is around to tell them otherwise.  I know I have my bad posts some places in the past, but those don't happen anymore
[/quote]

Well, I have been looking at this thread, feeling the itch to split and remove posts, but neither Yoni nor DarkVirus are involved with any MMORPGs at this time as far as I know....
[/quote]

I was actually trying to talk about a good chunk of forum in general, not just VB one
March 15, 2005, 7:29 PM
Grok
[quote author=UserLoser link=topic=10896.msg103958#msg103958 date=1110914986]
[quote author=Adron link=topic=10896.msg103916#msg103916 date=1110893523]
[quote author=UserLoser link=topic=10896.msg103862#msg103862 date=1110849297]
I have something to say about this... but I think the lack of moderation due to some people being involved in MMORPGs too much allowed some people to think they could post what they want and it'd be ok since nobody is around to tell them otherwise.  I know I have my bad posts some places in the past, but those don't happen anymore
[/quote]

Well, I have been looking at this thread, feeling the itch to split and remove posts, but neither Yoni nor DarkVirus are involved with any MMORPGs at this time as far as I know....
[/quote]

I was actually trying to talk about a good chunk of forum in general, not just VB one
[/quote]

I read the same forums today that I read before WoW came along.  What's your point?
March 15, 2005, 8:48 PM

Search