get keys in a section

Discuss and share scripts and script files...
Post Reply
yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

get keys in a section

Post 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

highend
Posts: 13274
Joined: 06 Feb 2011 00:33

Re: get keys in a section

Post 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");
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1123
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Re: get keys in a section

Post 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!

Post Reply