mIRC Homepage
Posted By: wulf INI files script.. - 28/08/06 02:30 AM
Is there an identified that i can call to determine if a specific section is in a file?

I know there is a command to determine if a topic is in a file, but i want to konw if there is a specfic section is in the file.
Posted By: hixxy Re: INI files script.. - 28/08/06 02:36 AM
A topic is a section.

if ($ini(<file>,<topic>)) { ... }
if ($ini(<file>,<topic>,<item>)) { ... }
Posted By: wulf Re: INI files script.. - 28/08/06 03:18 AM
yes, and it works fine if there is the specified setion. Example:

file.ini
[Section]
data=stuff

if i do $ini(file.ini,Section,data) it will return '1' like its supose to.
if i do $ini(file.ini,Section,data2) it returns 'insufficient parameters' (using a //echo -a)

Should it return '0' if the section does not exsist instead of just erroring out? Im trying to write a script that requires that ability to know if the section does NOT exsist, not if its already there.
Posted By: RusselB Re: INI files script.. - 28/08/06 03:22 AM
you can do something like

if !$ini(file.ini,Section,data2) { echo -a data2 doesn't exist }
Posted By: hixxy Re: INI files script.. - 28/08/06 03:23 AM
Code:
if ($ini(file.ini,Section,data2) == $null) { ; section does not exist }
© mIRC Discussion Forums