mIRC Home    About    Download    Register    News    Help

Print Thread
#157729 28/08/06 02:30 AM
Joined: Aug 2006
Posts: 23
W
wulf Offline OP
Ameglian cow
OP Offline
Ameglian cow
W
Joined: Aug 2006
Posts: 23
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.

#157730 28/08/06 02:36 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
A topic is a section.

if ($ini(<file>,<topic>)) { ... }
if ($ini(<file>,<topic>,<item>)) { ... }

#157731 28/08/06 03:18 AM
Joined: Aug 2006
Posts: 23
W
wulf Offline OP
Ameglian cow
OP Offline
Ameglian cow
W
Joined: Aug 2006
Posts: 23
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.

#157732 28/08/06 03:22 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
you can do something like

if !$ini(file.ini,Section,data2) { echo -a data2 doesn't exist }

#157733 28/08/06 03:23 AM
Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Code:
if ($ini(file.ini,Section,data2) == $null) { ; section does not exist }


Link Copied to Clipboard