Page 1 of 1

get keys in a section

Posted: 21 Mar 2018 12:22
by yusef88
Hi everyone
Can I get "Find & ExcludeFolders2 & LookIn" keys and write the output to "<xydata>\FindTemplates\search.ini"

Code: Select all

"Show Settings"
    $file = "<xydata>\xyplorer.ini";
    $contents = '';
    foreach ($section, getsectionlist(,$file), <crlf>) {
        $contents = $contents . "[$section]<crlf>";
        $contents = $contents . getsectionlist($section, $file) . <crlf 2>;
    }
    text $contents;
the original script viewtopic.php?f=3&t=13500&start=15#p119324

Re: get keys in a section

Posted: 21 Mar 2018 13:16
by highend
get keys in a section
Only keys, no values?

Why do you need a foreach loop if you know which sections are needed?

Code: Select all

    $src = "<xydata>\xyplorer.ini";
    $dst = "<xydata>\FindTemplates\search.ini";
    $findSect = getsectionlist("Find", $src);
    $exclSect = getsectionlist("ExcludeFolders2", $src);
    $lookinSect = getsectionlist("LookIn", $src);
    $data = <<<>>>
[Find]
$findSect

[ExcludeFolders2]
$exclSect

[LookIn]
$lookinSect

>>>;
    writefile($dst, $data, , "tu");

Re: get keys in a section

Posted: 21 Mar 2018 14:31
by yusef88
highend wrote:
get keys in a section
Only keys, no values?
Why do you need a foreach loop if you know which sections are needed?
I was sure that you would understand what I wanted even if I couldn't explain it properly :)
Thank you!