Page 2 of 2

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 14:20
by 40k
DmFedorov wrote:40k
With your script I receive

F:\_New\inspector.js
You need to install a Chrome extension
Remove all DOM breakpoints
Save entry as HAR
----------------
F:\_New\NetworkPanel.js
You need to install a Chrome extension
Remove all DOM breakpoints
Save entry as HAR
----------------
F:\_New\ProfilesPanel.js
You need to install a Chrome extension
Remove all DOM breakpoints
Save entry as HAR
----------------
F:\_New\ResourcesPanel.js
You need to install a Chrome extension
Remove all DOM breakpoints
Save entry as HAR
----------------
Well on my test the script works.
You've got to make absolutely sure that you only enter 1 string per line in the in.txt file. You also NEED to push ENTER after every line, including the string on the last line.
Can you upload the *.js files you are using? I have a feeling there's probably another factor involved that neither highend nor I can recreate without seeing the files.

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 14:25
by highend
I have a feeling there's probably another factor involved that neither highend nor I can recreate without seeing the files
I'd say they use a weird encoding... so regexreplace / strpos aren't able to get their matches...

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 14:32
by DmFedorov
highend wrote:You mean: It's only missing in the file "inspector.js"...
No, it missing in all files, but I have in output this:

F:\_New\inspector.js - Save entry as HAR
F:\_New\NetworkPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
F:\_New\ProfilesPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
F:\_New\ResourcesPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
highend wrote:You've said that you want the file together with the missing strings, so the output should still be:
D:\Temp\test\inspector.js - Save entry as HAR
I don't said it and don't want it. If I will have not 4 files, but 100 files, I will have 100 strings with missed in this files "Save entry as HAR"
Off course i want see only such strings that missed in all files, and only one time.

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 14:37
by 40k
DmFedorov wrote:
highend wrote:You mean: It's only missing in the file "inspector.js"...
No, it missing in all files, but I have in output this:

F:\_New\inspector.js - Save entry as HAR
F:\_New\NetworkPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
F:\_New\ProfilesPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
F:\_New\ResourcesPanel.js - You need to install a Chrome extension|Remove all DOM breakpoints|Save entry as HAR
highend wrote:You've said that you want the file together with the missing strings, so the output should still be:
D:\Temp\test\inspector.js - Save entry as HAR
I don't said it and don't want it. If I will have not 4 files, but 100 files, I will have 100 strings with missed in this files "Save entry as HAR"
Off course i want see only such strings that missed in all files, and only one time.
Well that was not clear from your initial post.
You want the strings that are missing in any files only to show once?

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 15:04
by highend
It's (almost) christmas, I'd rather not to ask who wasn't clear on what he needs exactly...

I'm just to lazy to spend more time on it... Now it takes 3 times longer but I guess that's what he wanted...

Code: Select all

    // Searches all text files in the current folder for non matching terms
    $searchStrings = input("Enter the search terms...", "Terms MUST be separated by |", , "s", "none", 600, 200);
    if ($searchStrings == "" || $searchStrings == "none") {
        $searchStringsFile = inputfile("<curpath>", , "You did not enter any search terms, please select the file that contains them...<crlf>Terms MUST be separated by |");
        $searchStrings = readfile($searchStringsFile);
    }

    $allFiles = listfolder(, "*", 1, "|");

    $notFoundStrings = "";
    foreach($string, $searchStrings, "|") {
        $countNotFound = 0;
        $searchedFiles = 0;
        foreach($file, $allFiles, "|") {
            if (filetype($file) != "Binary") {
                $searchedFiles++;
                $fileContent = readfile($file);
                if (strpos($fileContent, $string) == -1) {
                    $countNotFound++;
                }
            }
        }
        if ($countNotFound == $searchedFiles) {
            $notFoundStrings = $notFoundStrings . $string . "<crlf>";
        }
    }
    text $notFoundStrings;

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 15:08
by DmFedorov
Yes!!

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 15:14
by DmFedorov
Absolutely what I wanted.
The only BUT - it is certainly more convenient through the list of files, but this is not a problem.

A great big thank you.

Re: request:find strings that are not in files of tab

Posted: 23 Dec 2013 15:32
by DmFedorov
40k wrote:Well on my test the script works.
You've got to make absolutely sure that you only enter 1 string per line in the in.txt file. You also NEED to push ENTER after every line, including the string on the last line.
Can you upload the *.js files you are using? I have a feeling there's probably another factor involved that neither highend nor I can recreate without seeing the files.
I have pushed extra Enter, but there is something.. on
$content = readfile($file, 't', , , );

or with variables.

There was error. I have no rights. and so on. But not now.
----------------

Thank you.