Sign in to follow this  
Followers 0
Krillr

[Solved] IniRead problem

9 posts in this topic

#1 ·  Posted (edited)

Hello. I was trying to learn how to use Ini files so i made theese 2 small scripts:

1.

$lol1 = InputBox("1", "Choose 1")
Sleep(1000)
$lol2 = InputBox("2", "Choose 2")
Sleep(500)
IniWrite ("Test1.ini", "section1", "Key1", $lol1)
Sleep(500)
IniWrite ("Test2.ini", "section2", "Key2", $lol2)

2.

$lol1= IniRead("Test1.ini", "section1", "Key1")
Sleep(500)
$lol2= IniRead("Test2.ini", "section2", "Key2")
Sleep(500)
Run("Notepad.exe")
Send($lol1)
Send("{Enter}")
Send($lol2)

When i use script number 1 it shows the Inputboxes, i write something in them and it creates the Test1.ini and Test2.ini.

Then i use Script 2 and i get some kind of error message.

$lol1=IniRead("Test1.ini", "section1", "Key1")

$lol1^ ERROR

Error: Incorrect number of parameters in function call.

I got no idea what that is. I dont know if theres an error in my script or what it is, but please help me :-)

I hope i posted this the right place and done it the right way and stuff ^^

Edited by Krillr

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

IniRead ( "filename", "section", "key", "default" )

default is the value that will be returned if the key does not exist.

Edited by Pain

Share this post


Link to post
Share on other sites

What should i write in the Default place? :S

Share this post


Link to post
Share on other sites

Something that will let the user know that the key was not found. In the helpfile example they use the string "NotFound".

IniRead("C:\Temp\myfile.ini", "section2", "key", "NotFound")

Share this post


Link to post
Share on other sites

IT WORKS! YAY. What do i do with this thread now? :S Close it or tag it or something?

Share this post


Link to post
Share on other sites

Nothing, but if you like you can click on Edit > Full Edit on your first post and add [solved] to the title.

Share this post


Link to post
Share on other sites

Where the Biip does it say Edit?

Share this post


Link to post
Share on other sites

On your first post it's a button right beside where the Quote and Reply buttons are.


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

#9 ·  Posted (edited)

Uhm.. Theres no button next to Quote and Reply :S

Edit: Found it, maybe it was because i was inactive? WHen i posted this reply the buttons showed up.

Edited by Krillr

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