Topic: Macro for easily using INI-files in your macros (1 of 1), Read 25 times, 3 File Attachments
Conf: VEDIT Macro Library
From: Christian Ziemski
Date: Monday, November 25, 2002 01:54 AM

[This is a rewritten message after more tests and redesigning (incl. bugfixing) the macro.]

In the earlier thread
"Tool for customizing macros via dialog menu"
I published a macro for saving configuration data in the macro itself.
Ted raised the idea to implement commands for INI-files instead.

Since he is very busy finishing VEDIT 6.1 I grabbed that task and wrote a macro for that purpose.


You can easily read/write strings or numerical values from/to an INI-file.


The implemented functions are:

(READ_STR, "section", "key", r, "default" [, "inifile"])
(READ_NUM, "section", "key", r, n [, "inifile"])

(WRITE_STR, "section", "key", "text" [, "inifile"])
(WRITE_NUM, "section", "key", n [, "inifile"])

(DELETE, "section", "key" [, "inifile"])

// "string" could also be: @r
// r could also be: #n
// n could also be: #n
//
// Allowed string delimiters: "'`^/


I attached the macro itself, a demo macro to show the usage and a sample INI-file.

To use it:
1.) save INIFILE.VDM and INI-DEMO.VDM to your user-mac directory
2.) save INI-DEMO.INI to your current directory or to be save in your c:\vedit directory.


Then simply execute INI-DEMO.VDM via {Misc, Load/Exec user macro}.

What it does:
a) Remembers and shows the date/time of last start.
b) Reads the serial# from the VEDIT.INI and displays it in the dialog.
c) Uses INI-DEMO.INI for some playing with.


Happy INI-ing

Christian

 
INI-DEMO.INI (1KB)
 
INI-DEMO.VDM (6KB)
 
INIFILE.VDM (16KB)