Sign in to follow this  
Followers 0
ACrapid

Questions regarding .ini configuration

12 posts in this topic

Hi guys, recently I started to mess around with C++, and I ended up with a 270line failure of a tool which I made.

The sole purpose of this code, was to open a game, in this case Warcraft 3.

Then to press the button "B" to enter the logon menu, which you could enter in a config.ini file, then to write the values written there, example:

[config]

username=usernamehere

password=passwordhere

Then the program would automaticly enter the Username given in the ini, press TAB, write the password and hit enter.

I did manage to make it work more or less, just that the prog pressed the wrong buttons.

Now, to my point, is it possible to make a ini reading executable that does such as stated above?

And in addition, somewhere along the lines in the ini, point to the destination of the exe and run it?

If anyone could point me in the right direction, that'd be helpful thanks.

I'm not asking for an entire source code, just pretty much for the ini write/read and enter it part :)

Thanks, sincerely

Alex.

Share this post


Link to post
Share on other sites



Take a look at IniRead, IniWrite, and IniReadSection. Those should give you what you need to edit any .ini file.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

I don't generally get involved in threads that reference games but for the INI part of it, have a look in the help file for IniRead() and IniWrite.

$sIni = @ScriptDir & "\config.ini"
$pass = IniRead($sIni, "Config", "username", "")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

I already have, but I can't seem to find any code where it WRITES from the ini, and to a active window.

Share this post


Link to post
Share on other sites

I already have, but I can't seem to find any code where it WRITES from the ini, and to a active window.

Get it to read the desired section of ini to a variable, and then use the "Send" function to send the key presses


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks for the quick reply JohnOne.

May you give me an example of a variable? thanks.

EDIT: Searched the help section, got 137 hits for "Variable." though none of them strikes me as "THIS IS THE ONE"

Edited by ACrapid

Share this post


Link to post
Share on other sites

;$Variable = IniRead(put in the parameters here)

$Variable = "THIS IS A VARIABLE"

ConsoleWrite($Variable & @CRLF)


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Haha, thanks guys.

I'm sorry for my noobyness, but at this

"THIS IS A VARIABLE"

What should I put in THISISAVARIABLE :)?

The sections of the .ini or what?

Edited by ACrapid

Share this post


Link to post
Share on other sites

whatever you want. The equals sign assigns whatever is to the left to the variable on the right. You need to search the help file now because every example in the help file uses variables.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

Defines a variable Is your section of ini Is the key you want to read that will be sent as a variable

$R = IniRead($sIni, "Config", "the particular key", "")

Then you would use Send($R) I think cant quite remember


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

So, "The particular key" in this case, would be "Username="

But, there's two sections, username and password :)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

The Section would be "Config". This is the only section from this example:

[config]

username=usernamehere

password=passwordhere

The Key would be either "username" or "password".

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

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  
Followers 0