Jump to content

Recommended Posts

Posted (edited)

From the beginning 3.3.13.0

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

If FileExists(@ScriptDir & "\@@End@@_检查.Log") Then FileDelete(@ScriptDir & "\@@End@@_检查.Log")
Global $Log_File = FileOpen(@ScriptDir & "\@@End@@_检查.Log", 9)

Global $Au3_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtFunctions"
Global $Key_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtKeywords"
Global $UDF_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtlibfunctions"

Global $aAu3 = _FileListToArray($Au3_Dir, "*.txt", $FLTA_FILES, False)
Global $aKey = _FileListToArray($Key_Dir, "*.txt", $FLTA_FILES, False)
Global $aUDF = _FileListToArray($UDF_Dir, "*.txt", $FLTA_FILES, False)

_Checking($Au3_Dir, $aAu3)
_Checking($Key_Dir, $aKey)
_Checking($UDF_Dir, $aUDF)

Func _Checking($Path, $Array)
    For $ii = 1 To $Array[0];
        Local $sFile = $Path & "\" & $Array[$ii]
        Local $iCountLines = _FileCountLines($sFile)
        For $i = $iCountLines To 1 Step -1
            Local $text = FileReadLine($sFile, $i)
            If $text = "@@End@@" Then
                $temp = FileReadLine($sFile, $i + 1)
                If $temp <> "" Then
                    _FileWriteToLine($sFile, $i, "@@End@@" & @CRLF, 1)
                    FileWriteLine($Log_File, $sFile & "  " & $i)
                EndIf
            Else
                ContinueLoop
            EndIf
        Next
    Next
EndFunc   ;==>_Checking
Edited by wyf
Posted

Please explain what it is you're trying to say. You aren't clear at all.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

  Reveal hidden contents

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Posted (edited)

I haven't tried your code, but this could be the consequence of how _FileCountLines() works. The code begins with StringStripWS() to remove trailing white space. Perhaps this is the effect you are seeing.

Edited by czardas
I just woke up!
Posted
  On 2/9/2016 at 3:13 PM, BrewManNH said:
  On 2/10/2016 at 6:06 AM, czardas said:

I haven't tried your code, but this could be the consequence of how _FileCountLines() works. The code begins with StringStripWS() to remove trailing white space. Perhaps this is the efPlease explain what it is you're trying to say. You aren't clear at all.fect you are seeing.

Expand  

 

Expand  
  On 2/10/2016 at 6:06 AM, czardas said:

I haven't tried your code, but this could be the consequence of how _FileCountLines() works. The code begins with StringStripWS() to remove trailing white space. Perhaps this is the effect you are seeing.

Expand  

Jon and forums administrator

I do not understand English, The following translated by Google.

I do not seek help!
Help documentation AutoIt.chm Lose 35 lines of text!
I am here this feedback error documents, and the cause of the error!
And Documentation Resources .txt file editor!

I am not a user of English documents, I am using a Chinese help documentation, and I already know the cause of the error, and has been amended!
Therefore, this error has no impact on Chinese users!

This is for the user to consider English !!!

Because do not understand English, also taking into account the code au3 language, editor Jon and documentation resources txt file should be able to understand the true intentions of the script!

If the forum administrator Jon and think this post does not make sense, please delete this post!

Posted (edited)

@wyf

Please post here single *.txt file, but in two versions - old and new .
Of course original - I mean english version.

We need to compare to understand what you mean.

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Ok. I play with it a little.

script refactoring:

;~ https://www.autoitscript.com/forum/topic/180499-autoitchm-lose-35-text-line/

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

If FileExists(@ScriptDir & "\@@End@@_检查.Log") Then FileDelete(@ScriptDir & "\@@End@@_检查.Log")
Global $hFile_Log = FileOpen(@ScriptDir & "\@@End@@_检查.Log", 9)

Global $Au3_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtFunctions"
Global $Key_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtKeywords"
Global $UDF_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtlibfunctions"

Global $aAu3 = _FileListToArray($Au3_Dir, "*.txt", $FLTA_FILES, False)
Global $aKey = _FileListToArray($Key_Dir, "*.txt", $FLTA_FILES, False)
Global $aUDF = _FileListToArray($UDF_Dir, "*.txt", $FLTA_FILES, False)

_Checking($Au3_Dir, $aAu3)
_Checking($Key_Dir, $aKey)
_Checking($UDF_Dir, $aUDF)

FileClose($hFile_Log)

Func _Checking($sPath, $aFileArray)
    Local $sCurrentFile = '', $sAnalyzedLine = '', $sNextLine = ''
    Local $iCountLines = 0

    For $iFile_idx = 1 To $aFileArray[0] ;
        $sCurrentFile = $sPath & "\" & $aFileArray[$iFile_idx]
        $iCountLines = _FileCountLines($sCurrentFile)

        For $iLine_idx = $iCountLines To 1 Step -1
            $sAnalyzedLine = FileReadLine($sCurrentFile, $iLine_idx)
            If $sAnalyzedLine = "@@End@@" Then
                $sNextLine = FileReadLine($sCurrentFile, $iLine_idx + 1)
                If $sNextLine <> "" Then
                    _FileWriteToLine($sCurrentFile, $iLine_idx, "@@End@@" & @CRLF, 1)
                    FileWriteLine($hFile_Log, $sCurrentFile & "  " & $iLine_idx)
                EndIf
            ; Else
            ;   ContinueLoop ; by the way Continue Loop is unnecessary in this case.
            EndIf
        Next

    Next

EndFunc    ;==>_Checking

 

Results:

  Reveal hidden contents


Example results: AU3_DOC.ZIP  StringRegExp.txt and modified StringRegExp_wyf.txt 

@wyf It seems that, you have to mean missing newline characters,

AU3_DOC.ZIP

 

HELPFILE_wyf_modification.png

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
  On 2/11/2016 at 1:28 AM, mLipok said:

Ok. I play with it a little.

script refactoring:

;~ https://www.autoitscript.com/forum/topic/180499-autoitchm-lose-35-text-line/

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

If FileExists(@ScriptDir & "\@@End@@_检查.Log") Then FileDelete(@ScriptDir & "\@@End@@_检查.Log")
Global $hFile_Log = FileOpen(@ScriptDir & "\@@End@@_检查.Log", 9)

Global $Au3_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtFunctions"
Global $Key_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtKeywords"
Global $UDF_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtlibfunctions"

Global $aAu3 = _FileListToArray($Au3_Dir, "*.txt", $FLTA_FILES, False)
Global $aKey = _FileListToArray($Key_Dir, "*.txt", $FLTA_FILES, False)
Global $aUDF = _FileListToArray($UDF_Dir, "*.txt", $FLTA_FILES, False)

_Checking($Au3_Dir, $aAu3)
_Checking($Key_Dir, $aKey)
_Checking($UDF_Dir, $aUDF)

FileClose($hFile_Log)

Func _Checking($sPath, $aFileArray)
    Local $sCurrentFile = '', $sAnalyzedLine = '', $sNextLine = ''
    Local $iCountLines = 0

    For $iFile_idx = 1 To $aFileArray[0] ;
        $sCurrentFile = $sPath & "\" & $aFileArray[$iFile_idx]
        $iCountLines = _FileCountLines($sCurrentFile)

        For $iLine_idx = $iCountLines To 1 Step -1
            $sAnalyzedLine = FileReadLine($sCurrentFile, $iLine_idx)
            If $sAnalyzedLine = "@@End@@" Then
                $sNextLine = FileReadLine($sCurrentFile, $iLine_idx + 1)
                If $sNextLine <> "" Then
                    _FileWriteToLine($sCurrentFile, $iLine_idx, "@@End@@" & @CRLF, 1)
                    FileWriteLine($hFile_Log, $sCurrentFile & "  " & $iLine_idx)
                EndIf
            ; Else
            ;   ContinueLoop ; by the way Continue Loop is unnecessary in this case.
            EndIf
        Next

    Next

EndFunc    ;==>_Checking

 

Results:

  Reveal hidden contents


Example results: AU3_DOC.ZIP  StringRegExp.txt and modified StringRegExp_wyf.txt 

@wyf It seems that, you have to mean missing newline characters,

AU3_DOC.ZIP

 

HELPFILE_wyf_modification.png

Expand  

OK !!!! mean missing newline characters, Resulting in the loss of the document text.

StringRegExp.txt missing 14 lines of text

Edited by wyf
Posted

That's how I designed the new build script. No real issue as far as I am concerned.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted (edited)

here is little modified scirpt:

;~ https://www.autoitscript.com/forum/topic/180499-autoitchm-lose-35-text-line/

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

If FileExists(@ScriptDir & "\@@End@@_检查.Log") Then FileDelete(@ScriptDir & "\@@End@@_检查.Log")
Global $hFile_Log = FileOpen(@ScriptDir & "\@@End@@_检查.Log", 9)
Global $hFile_Log_2 = FileOpen(@ScriptDir & "\@@End@@_检查_2.Log", 9)

Global $Au3_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtFunctions"
Global $Key_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtKeywords"
Global $UDF_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtlibfunctions"

Global $aAu3 = _FileListToArray($Au3_Dir, "*.txt", $FLTA_FILES, False)
Global $aKey = _FileListToArray($Key_Dir, "*.txt", $FLTA_FILES, False)
Global $aUDF = _FileListToArray($UDF_Dir, "*.txt", $FLTA_FILES, False)

_Checking($Au3_Dir, $aAu3)
_Checking($Key_Dir, $aKey)
_Checking($UDF_Dir, $aUDF)

FileClose($hFile_Log)
FileClose($hFile_Log_2)

Func _Checking($sPath, $aFileArray)
    Local $sCurrentFile = '', $sAnalyzedLine = '', $sNextLine = ''
    Local $iCountLines = 0

    For $iFile_idx = 1 To $aFileArray[0] ;
        $sCurrentFile = $sPath & "\" & $aFileArray[$iFile_idx]
        $iCountLines = _FileCountLines($sCurrentFile)

        For $iLine_idx = $iCountLines To 1 Step -1
            $sAnalyzedLine = FileReadLine($sCurrentFile, $iLine_idx)
            If $sAnalyzedLine = "@@End@@" Then
                $sNextLine = FileReadLine($sCurrentFile, $iLine_idx + 1)
                If $sNextLine <> "" Then
                    _FileWriteToLine($sCurrentFile, $iLine_idx, "@@End@@" & @CRLF, 1)
                    FileWriteLine($hFile_Log, $sCurrentFile & "  " & $iLine_idx)
                Else
                    FileWriteLine($hFile_Log_2, $sCurrentFile & "  " & $iLine_idx)
                EndIf
            EndIf
        Next

    Next

EndFunc    ;==>_Checking

 

Remarks:
The second file log shows that there is many (much more) other files, which have such, a new line just after @@End@@
So it's kind of exception to the rule (inconsistency). I think that's what Members wanted to tell us.


Edit:
EXAMPLE:
 

  Reveal hidden contents

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 2/11/2016 at 8:10 AM, mLipok said:

here is little modified scirpt:

;~ https://www.autoitscript.com/forum/topic/180499-autoitchm-lose-35-text-line/

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <File.au3>
#include <Array.au3>

If FileExists(@ScriptDir & "\@@End@@_检查.Log") Then FileDelete(@ScriptDir & "\@@End@@_检查.Log")
Global $hFile_Log = FileOpen(@ScriptDir & "\@@End@@_检查.Log", 9)
Global $hFile_Log_2 = FileOpen(@ScriptDir & "\@@End@@_检查_2.Log", 9)

Global $Au3_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtFunctions"
Global $Key_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtKeywords"
Global $UDF_Dir = @ScriptDir & "\autoit-docs-v3.3.15.0-src\docs\autoit\english\txt2htm\txtlibfunctions"

Global $aAu3 = _FileListToArray($Au3_Dir, "*.txt", $FLTA_FILES, False)
Global $aKey = _FileListToArray($Key_Dir, "*.txt", $FLTA_FILES, False)
Global $aUDF = _FileListToArray($UDF_Dir, "*.txt", $FLTA_FILES, False)

_Checking($Au3_Dir, $aAu3)
_Checking($Key_Dir, $aKey)
_Checking($UDF_Dir, $aUDF)

FileClose($hFile_Log)
FileClose($hFile_Log_2)

Func _Checking($sPath, $aFileArray)
    Local $sCurrentFile = '', $sAnalyzedLine = '', $sNextLine = ''
    Local $iCountLines = 0

    For $iFile_idx = 1 To $aFileArray[0] ;
        $sCurrentFile = $sPath & "\" & $aFileArray[$iFile_idx]
        $iCountLines = _FileCountLines($sCurrentFile)

        For $iLine_idx = $iCountLines To 1 Step -1
            $sAnalyzedLine = FileReadLine($sCurrentFile, $iLine_idx)
            If $sAnalyzedLine = "@@End@@" Then
                $sNextLine = FileReadLine($sCurrentFile, $iLine_idx + 1)
                If $sNextLine <> "" Then
                    _FileWriteToLine($sCurrentFile, $iLine_idx, "@@End@@" & @CRLF, 1)
                    FileWriteLine($hFile_Log, $sCurrentFile & "  " & $iLine_idx)
                Else
                    FileWriteLine($hFile_Log_2, $sCurrentFile & "  " & $iLine_idx)
                EndIf
            EndIf
        Next

    Next

EndFunc    ;==>_Checking

 

Remarks:
The second file log shows that there is many (much more) other files, which have such, a new line just after @@End@@
So it's kind of exception to the rule (inconsistency). I think that's what Members wanted to tell us.


Edit:
EXAMPLE:
 

  Reveal hidden contents

 

Expand  

Thank you

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...