Hi Dave,
I read it quickly but your section name is before the word Text for the
attribute type of the value you want saved, it seems you would have an error
there.
For your IniFile( path/filename).Text or . Number( Section, Key, Default) =
val
Just an observation Dave.
Bruce
Sent: Thursday, May 31, 2012 1:25 PM
Subject: Re: Registering new keys in the INI file
David,
Your Window-Eyes part of this is fine.
But when you are reading the line, shouldn't your line be something like:
Incoming = InputFile.ReadLine
Its been awhile since I've done the text file reading stuff so I can't
remember for sure.
But bottom line, my guess would be the Incoming variable isn't what you think
it is. if you hard code the Incoming variable to a string, you'll see it works
fine.
Doug
On 5/31/2012 12:46 PM, David wrote:
OK, I am playing around with some INI stuff. Somehow it does not work. Am I
doing something wrong, or does it not work due to the feature not being
supported?
I have the need for saving some keys and values on the fly. Fact is, that
even the keys might be created on the fly, due to some actions performed in the
app. A basic example, would be like this:
InputFile.ReadLine Incoming
Value = 93
RegIni( Incoming )
Sub RegIni( NewKey )
Set MIF = IniFile( ClientInformation.ScriptPath &"\MyApp.ini" )
MIF.Text( "MyKeys", NewKey ) = Value
Set MIF = Nothing
End Sub 'RegIni.
OK, so in this example, we read a string from a source, like a file. This
string, would be the name of our new key. We then set the Value to a number, it
could be either a hard-coded value, or something created by the app on the fly.
Next, The sub RegIni is being called. Reason for putting it into a sub, is
that then we can call it at any time in the code processing, without repeating
the lines in our code. Besides, makes the stuff a bit more tidy.
My Idea was to have the sub create the new key, with the incoming name,
under the section named
MyKeys. This section already exists in the INI file. Well, the thing is,
that running the above code, does NOT add a new key to the INI. It actually
does do nothing to the INI file at all. Have a feeling I am missing something
here. But what?
Any feedback is more than welcome here.