What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Read, write and delete from/to ini file

[Request] Read, write and delete from/to ini file
Author: Message:
Skarbo
New Member
*


Posts: 7
38 / Male / Flag
Joined: Apr 2008
O.P. [Request] Read, write and delete from/to ini file
This was a bit hard to search for (since ini is a 3 letter word^^), sorry if its a repost.

I found these scripts:
Ini to object: http://mpscripts.net/code.php?id=12
Read INI Files: http://mpscripts.net/code.php?id=23
Text Files Operations: http://mpscripts.net/code.php?id=7
But they dont have all the commands that i need.

I would like a script that has these commands:

ReadIni(path, header, key) -> Returns the key value
WriteIni(path, header, key, value) -> Writes the value beneath the header, creates a new header if it does not already exist.
DeleteIni(path, header) -> Deletes the header, keys and the values
DeleteIni(path, header, key) -> Deletes the key and the value

Or is there an easier way to store simple data?
My data will be used to store game statistics etc.

This post was edited on 04-23-2008 at 09:44 AM by Skarbo.
04-23-2008 09:21 AM
Profile E-Mail PM Find Quote Report
felipEx
Scripting Contest Winner
***


Posts: 378
Reputation: 24
35 / Male / Flag
Joined: Jun 2006
RE: [Request] Read, write and delete from/to ini file
try this :)
code:
function DeleteHeader(path, header){
Interop.Call('kernel32', 'WritePrivateProfileSectionW', header.toString(), 0, path )
}

function DeleteKey(path, header, key){
Interop.Call('kernel32', 'WritePrivateProfileStringW', header.toString(), key.toString(), 0, path)
}

function WriteIni(path, header, key, value){
Interop.Call('kernel32', 'WritePrivateProfileStringW', header.toString(), key.toString(), value.toString(), path);
}

function ReadIni(path, header, key, default_value){
    var cRetVal = Interop.Allocate(2 * (256 + 1) );
    var lTmp = Interop.Call('kernel32','GetPrivateProfileStringW', header, key.toString(), default_value.toString(), cRetVal, cRetVal.Size, path);
    return lTmp == 0 ? default_value : cRetVal.ReadString(0);
}


04-23-2008 09:56 AM
Profile E-Mail PM Find Quote Report
Skarbo
New Member
*


Posts: 7
38 / Male / Flag
Joined: Apr 2008
O.P. RE: [Request] Read, write and delete from/to ini file
Thanks!
04-23-2008 10:15 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On