• Welcome to Valhalla Legends Archive.
 

I need help creating Access for my bot

Started by Almighty, December 29, 2005, 12:46 AM

Previous topic - Next topic

Almighty

I wanna make access load and read from Access.ini or Users.txt file but i really dont know where to start jus need a lil a help

Joe[x86]

I'm not totally evil, so here, I'll give you a place to start.

Kernel32.dll:

GetPrivateProfileStringA {
    LPCSTR lpApplicationName,
    LPCSTR lpKeyName,
    LPCSTR lpDefault,
    LPCSTR lpReturnedString,
    int nSize,
    LPCSTR lpFileName
};
int WritePrivateProfileStringA {
    LPCSTR lpApplicationName,
    LPCSTR lpKeyName,
    LPCSTR lpString,
    LPCSTR lpFileName
};
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

Ryan Marcus

Uh.. either I'm dumb or your code makes no sence for writting and reading files...


Here is some REALbasic code that simply writes out a text file and looping through an array of users, pretty basic stuff.. You should have learned this before you came close to being able to write a bot.. You should be able to adapt it to VB easily.


dim textout as textoutputstream
dim f as folderitem
dim i as integer

f = GetFolderItem("users.txt")
textout = f.CreateTextFile

while i<>UBound(users) + 1
textout.writeline(users(i).someprop)
textout.writeline(users(i).someprop)
textout.writeline(users(i).someprop)
i =i + 1
wend


Hope that helps.
--
Thanks, Ryan Marcus.

Author of the only update mac binary bot, Luxer. http://luxer.cjb.net.

MyndFyre

Quote from: Ryan Marcus on December 31, 2005, 09:46 PM
Uh.. either I'm dumb or your code makes no sence for writting and reading files...

The information that Joe provided are exports from Windows' kernel32.dll (and kernel32.lib) for reading and writing .ini files.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Joe[x86]

#4
It may be worth noting that Visual Basic has no TextOutputStream. Asuming you were going to do it Ryan's way, which I don't recomment (the Kernel32 calls are more efficient, and easier), then you'd use the following code:

Dim FileHandle&: FileHandle = #FreeFile
Open App.Path & "\config.ini" For Append as FileHandle '// Note: You may want to change config.ini to whatever setting file you're using.
   Print #1, "SettingName=SettingValue"
Close FileHandle


EDIT -
If for some reason you wanted to write UTF-8 widestrings, define the DLL calls as GetPrivateProfileStringW and WritePrivateProfileStringW.
Quote from: brew on April 25, 2007, 07:33 PM
that made me feel like a total idiot. this entire thing was useless.

MyndFyre

Quote from: Joe on January 01, 2006, 05:36 AM
It may be worth noting that Visual Basic has no TextOutputStream. Asuming you were going to do it Ryan's way, which I don't recomment (the Kernel32 calls are more efficient, and easier), then you'd use the following code:

Dim FileHandle&: FileHandle = #FreeFile
Open App.Path & "\config.ini" For Append as FileHandle '// Note: You may want to change config.ini to whatever setting file you're using.
   Print #1, "SettingName=SettingValue"
Close FileHandle


EDIT -
If for some reason you wanted to write UTF-8 widestrings, define the DLL calls as GetPrivateProfileStringW and WritePrivateProfileStringW.

Why are you posting rather pointless nonsense trying to criticize Ryan?  The original poster never said ANYTHING about what he's writing in.  For all you know he might be in RB; he certainly never said he was using VB.

Of course, the quality of the original post made everyone ASSUME it was a VB luser, but that's another debate.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Warrior

Quote from: effect on March 09, 2006, 11:52 PM
Islam is a steaming pile of fucking dog shit. Everything about it is flawed, anybody who believes in it is a terrorist, if you disagree with me, then im sorry your wrong.

Quote from: Rule on May 07, 2006, 01:30 PM
Why don't you stop being American and start acting like a decent human?

Ryan Marcus

Quote
Why are you posting rather pointless nonsense trying to criticize Ryan?  The original poster never said ANYTHING about what he's writing in.  For all you know he might be in RB; he certainly never said he was using VB.
Its cool. I know Joe pretty well from x86. I don't think he met any offense, but he could have worded that a bit better.

Quote
Of course, the quality of the original post made everyone ASSUME it was a VB luser, but that's another debate.

I would'nt even call it a debate... If somebody can write a bot before they can write out to a file and read one in, they are using CSB (and thus have no idea what they are doing), or they are some crazy raised from birth by evil anti-blizzard nazi's who want to conquer all of battle.net with an ultimate flood bot... The later does not seem too promising, but it sounds cooler. ;)


I posted the RB because I assumed it could be easily converted to VB. Apartly, thats something that can't.
--
Thanks, Ryan Marcus.

Author of the only update mac binary bot, Luxer. http://luxer.cjb.net.

FrOzeN

Quote from: Joe on January 01, 2006, 05:36 AM
It may be worth noting that Visual Basic has no TextOutputStream.
It may be worth noting that Ryan said that was for REALbasic.

In Visual Basic 6 his code would look like:
Dim oFSO As New Scripting.FileSystemObject
Dim oFile As Scripting.File
Dim i As Integer

Set oFile = oFSO.OpenTextFile(App.Path & "\users.txt", ForWriting, True)

While i <> UBound(users) + 1
    oFile.WriteLine users(i).someprop
    oFile.WriteLine users(i).someprop
    oFile.WriteLine users(i).someprop
    i = i + 1
Wend

Set oFile = Nothing
~ FrOzeN