Jump to content

Tidy major Update (2-Nov-2018)


Jos
 Share

Recommended Posts

  • Developers

I am reaching out to you all to test this version of Tidy to see whether that works on your scripts and report back your finding.

Changes in this version:

  • Leave inline comments on the original position when the line is tidied, where possible.
  • Handle None Breaking Spaces (NBS) for Ascii and UTF8 files:
    • NBS characters within the leading & trailing whitespace and inside the code will be replaced by a regular space to allow tidy to properly tidy the code.
    • NBS characters in a literal string will not be replaced as they are presumably there for a reason.
    • NBS characters inside an inline comment will be left alone too.
  • Added support for directive: #Tidy_ILC_Pos=nn (See below for details)
  • Replaced /Skip_Commentblock & /scb  for /Tidy_Comment block & /tcb and made the default not to tidy comment blocks, as they are frequently used for simple documentation which would making tidying impossible.
    • /tcb=0               =>only indent the whole commentblock  (default)
    • /tcb  or /tcb=1 =>Tidy inside commentblock
    • /tcb=-1              =>leave whole commentbock alone
  • Added support for the following tidy.ini settings:
    • #-->Define the TabSize size
      tabsize=4
    • #--> Tidy commentblock 1=Tidy, 0=Do not tidy  default=0
      Tidy_commentblock=0
      #-->Define the default column for inline comments, 0=keep current position
      icl_pos=0
  • Changed the logic for the comment part of #directives. See last example for an explanation
  • Fixed issue in "Variable proper" function, sometimes not updating the variable to the proper caps. 
  • Changed the program to CUI to show console output when ran from CMD prompt.
  • Changed the returncode to -1 when no changes are made.
    • A change in AutoIt3Wrapper will test for this and show as such.

Updated support for inline comments:

One of the items that has been on my wish-/todolist for a long time was to leave inline comments as they were, instead of removing all whitespace between statement and inline comment: For example that this untidied code:

global $A=1
if $a=1 then     ; test $a
$a=2             ; Set $a
endif            ; end test

The current production version will change that to:

Global $A = 1
If $a = 1 Then ; test $a
    $a = 2 ; Set $a
EndIf ; end test

The new Beta version will change that to: (leaving the Comment start column the same as it was)

Global $A = 1
If $A = 1 Then    ; test $a
    $A = 2        ; Set $a
EndIf             ; end test

Tidy.Ini optional change

Tidy will determine the position of the inline comment by using the tabchar & tabsize parameter from Tidy.ini:

[ProgramSettings]
 * * *  Indent  0 = Tabs  >0 = Number of Space
tabchar=0
tabsize=4
#-->Define the default column for inline comments, 0=keep current position
icl_pos=0
#--> Tidy commentblock 0=only indent the whole commentblock  (default=0)
#                      1=Tidy inside commentblock
#                     -1=leave whole commentbock alone
Tidy_commentblock=0

When not provided in the INI it will be defaulted to Using Tabs with a size of 4.
When running from within SciTE, a warning is shown in the SciTE console, when they deviate from the SciTE Settings for:
use.tabs=1
indent.size=4

It could help while testing to use Winmerge to see what exactly was changed during the Tidy run by adding this to Tidy.ini:

ShowDiffPgm = """C:\Program Files (x86)\WinMerge\winmergeu.exe" "%new%" "%old%"""

Support for directive #Tidy_ILC_Pos=nn

Tidy will keep inline comment on their original position, but this can be overridden by the directive: #Tidy_ILC_Pos=nn
When nn is greater than 0, Tidy will use the defined number as the Inline comment start column going forward.
When nn= 0 then use the old ILC column. 
When nn= -1 then strip the spaces between Code and ILC (Old Tidy behavior)

EG  Original Tidied script:

Global Enum _
        $ADO_ERR_SUCCESS, _            ; No Error
        $ADO_ERR_GENERAL, _             ; General - some ADO Error - Not classified type of error
        $ADO_ERR_ENUMCOUNTER           ; just for testing

Global Const $ADO_EXT_DEFAULT          ; default Extended Value
Global Const $ADO_EXT_PARAM1            ; Error Occurs in Parameter #1
Global Const $ADO_EXT_PARAM2          ; Error Occurs in Parameter #2
Global Const $ADO_EXT_PARAM3           ; Error Occurs in Parameter #3

Now with new directive added to line up the inline comments:

#Tidy_ILC_Pos=40
Global Enum _
        $ADO_ERR_SUCCESS, _            ; No Error
        $ADO_ERR_GENERAL, _            ; General - some ADO Error - Not classified type of error
        $ADO_ERR_ENUMCOUNTER           ; just for testing

Global Const $ADO_EXT_DEFAULT          ; default Extended Value
Global Const $ADO_EXT_PARAM1           ; Error Occurs in Parameter #1
Global Const $ADO_EXT_PARAM2           ; Error Occurs in Parameter #2
Global Const $ADO_EXT_PARAM3           ; Error Occurs in Parameter #3

Example  Setting the new column to different values and back to original (0)
Before Tidy run:

#Tidy_ILC_Pos=30
Global Enum _
        $ADO_ERR_SUCCESS, _            ; No Error
        $ADO_ERR_GENERAL, _            ; General - some ADO Error - Not classified type of error
        $ADO_ERR_ENUMCOUNTER           ; just for testing
#Tidy_ILC_Pos=50 
Global Const $ADO_EXT_DEFAULT          ; default Extended Value
Global Const $ADO_EXT_PARAM1           ; Error Occurs in Parameter #1
Global Const $ADO_EXT_PARAM2           ; Error Occurs in Parameter #2
Global Const $ADO_EXT_PARAM3           ; Error Occurs in Parameter #3
Global Const $ADO_EXT_PARAM4           ; Error Occurs in Parameter #4
#Tidy_ILC_Pos=0
Global Const $ADO_EXT_PARAM5           ; Error Occurs in Parameter #5
Global Const $ADO_EXT_PARAM6           ; Error Occurs in Parameter #6
Global Const $ADO_EXT_INTERNALFUNCTION ; Error Related to internal Function - should not happend - UDF Developer make something wrong ???
Global Const $ADO_EXT_ENUMCOUNTER      ; just for testing

After Tidy run:

#Tidy_ILC_Pos=30
Global Enum _
        $ADO_ERR_SUCCESS, _  ; No Error
        $ADO_ERR_GENERAL, _  ; General - some ADO Error - Not classified type of error
        $ADO_ERR_ENUMCOUNTER ; just for testing
#Tidy_ILC_Pos=50
Global Const $ADO_EXT_DEFAULT                    ; default Extended Value
Global Const $ADO_EXT_PARAM1                     ; Error Occurs in Parameter #1
Global Const $ADO_EXT_PARAM2                     ; Error Occurs in Parameter #2
Global Const $ADO_EXT_PARAM3                     ; Error Occurs in Parameter #3
Global Const $ADO_EXT_PARAM4                     ; Error Occurs in Parameter #4
#Tidy_ILC_Pos=0
Global Const $ADO_EXT_PARAM5           ; Error Occurs in Parameter #5
Global Const $ADO_EXT_PARAM6           ; Error Occurs in Parameter #6
Global Const $ADO_EXT_INTERNALFUNCTION ; Error Related to internal Function - should not happend - UDF Developer make something wrong ???
Global Const $ADO_EXT_ENUMCOUNTER      ; just for testing

Example  what happens with the different directives
Before Tidy run:

#Tidy_ILC_Pos=40

#UnknowDirective test           ; comment

; Know directives/preprocessor Table -> au3.keywords.properties
;~ au3.keywords.special=#endregion #forcedef #forceref #ignorefunc #pragma #region
#Region test   ;test            ; comment there not enough spaces, so simply copy Eveything after #Region to #EndRegion
#EndRegion test                 ; will be replaced
#Region    test                 ; comment there are 4 spaces after #region so can line it up with EndRegion
#EndRegion test                 ; will be replaced
#forcedef aaaaaa                ; comment - linedup at Pos 40
#pragma compile(UPX, False)     ; comment - linedup at Pos 40

;~ au3.keywords.preprocessor=#ce #comments-end #comments-start #cs #include #include-once \
;~  #notrayicon #onautoitstartregister #requireadmin
#NoTrayIcon                     ; comment - linedup at Pos 40
#RequireAdmin                   ; comment - linedup at Pos 40
#OnAutoItStartRegister "test"   ; comment - linedup at Pos 40
; -- Special treatment in au3lexer
#cs test                        ; comment Start - copy all after #CS to #CE
#ce test                        ; will be replaced
#comments-start                 ; comment Start copy all after #CS to #CE
#comments-end                   ; will be replaced

; Knows Direcitves/Special table -> autoit3wrapper.keywords.properties
#AutoIt3Wrapper_Add_Constants=n ; comment - linedup at Pos 40
#Au3Stripper_Ignore_Variables   ; comment - linedup at Pos 40
#Tidy_Parameters=1              ; comment - linedup at Pos 40

After Tidy run:

#Tidy_ILC_Pos=40

#UnknowDirective test           ; comment

; Know directives/preprocessor Table -> au3.keywords.properties
;~ au3.keywords.special=#endregion #forcedef #forceref #ignorefunc #pragma #region
#Region test   ;test            ; comment there not enough spaces, so simply copy Eveything after #Region to #EndRegion
#EndRegion test   ;test            ; comment there not enough spaces, so simply copy Eveything after #Region to #EndRegion
#Region    test                 ; comment there are 4 spaces after #region so can line it up with EndRegion
#EndRegion test                 ; comment there are 4 spaces after #region so can line it up with EndRegion
#forcedef aaaaaa                       ; comment - linedup at Pos 40
#pragma compile(UPX, False)            ; comment - linedup at Pos 40

;~ au3.keywords.preprocessor=#ce #comments-end #comments-start #cs #include #include-once \
;~  #notrayicon #onautoitstartregister #requireadmin
#NoTrayIcon                            ; comment - linedup at Pos 40
#RequireAdmin                          ; comment - linedup at Pos 40
#OnAutoItStartRegister "test"          ; comment - linedup at Pos 40
; -- Special treatment in au3lexer
#cs test                        ; comment Start - copy all after #CS to #CE
#ce test                        ; comment Start - copy all after #CS to #CE
#comments-start                 ; comment Start copy all after #CS to #CE
#comments-end                   ; comment Start copy all after #CS to #CE

; Knows Direcitves/Special table -> autoit3wrapper.keywords.properties
#AutoIt3Wrapper_Add_Constants=n        ; comment - linedup at Pos 40
#Au3Stripper_Ignore_Variables          ; comment - linedup at Pos 40
#Tidy_Parameters=1                     ; comment - linedup at Pos 40

I like to thank @mLipok for the testing/ideas/questions during the development of this change.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Jos changed the title to Tidy major Update - requesting help with testing!
  • Jos pinned this topic

Thanks @Jos

To all interested in testing: This is my testing script:
 

#Tidy_ILC_Pos=-1 ; strip space between "code end" and "comment start" to single space (old behavior) - this mean move dynamicaly "InLineComment_Pos" starting in line at "comment start" to nearest "code end" column position
#Tidy_ILC_Pos=0  ; save my (user) manually set "InLineComment_Pos" (do not move them) - THIS IS DEFAULT NEW CURRENT BEHAVIOR
#Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50

#cs ; comment for #CE
    Func _CommentedFunction()
        For $i =1 To 10
            ; some comment
                ; REMARK 1: #Tidy_ILC_Pos start acting from next line
                ; REMARK 2: #Tidy_ILC_Pos does not apply to lines wiht #Region and #EndRegion directives
        Next
    EndFunc     ;==>_CommentedFunction
#CE ; comment for #CE
; REMARK 4: #Tidy_ILC_Pos does not act on line without code

Global Enum _
        $UDFNAME_ERR_SUCCESS, _              ; No Error
        $UDFNAME_ERR_GENERAL, _              ; General - some Error - Not classified type of error
        $UDFNAME_ERR_ENUMCOUNTER              ; just for testing

#Tidy_ILC_Pos=40
Global Const $UDFNAME_EXT_DEFAULT =0          ; default Extended Value
Global Const $UDFNAME_EXT_PARAM1 =1            ; Error Occurs in Parameter #1
Global Const $UDFNAME_EXT_PARAM2 =2             ; Error Occurs in Parameter #2
Global Const $UDFNAME_EXT_PARAM3 =3             ; Error Occurs in Parameter #3

#Tidy_ILC_Pos=0 ; do not change user ILC_Pos
_Example_1()

Func _Example_1()       ; user manually set InLineComment_Pos as column #25 - will not be moved as #Tidy_ILC_Pos=0

              While        1      ; user manually set InLineComment_Pos as column #35 - will not be moved as #Tidy_ILC_Pos=0
    WEnd

    #Tidy_ILC_Pos=55
    For $i = 1      To      10   ; For                ; some important Loop
    Next   ; next    ; important Loop ending

    For $i = 1      To $aFileList[0]                 ; For ;  $aFileList: - HEADER
        ; some processing
        ; some processing
        ; some processing
        SomeFunction1()              ; Looping $aFileList: Warning .... this is important part ....
        ; some processing
        ; some processing
        ; some processing
        SomeFunction2()               ; Looping $aFileList: !!! do not delete this line. It's prventing ERROR on .....
        ; some processing
        ; some processing
        ; some processing
        SomeFunction3()          ; Looping $aFileList: CleanUp for GPDR !
    Next   ; Next ;  $aFileList: - END Looping

    #Tidy_ILC_Pos=80
            MsgBox(      0    ,      '              '        ,       1)                           ; SOME DISTANT COMMENT AT 99 COLUMN
EndFunc

#Tidy_ILC_Pos=45
Func _Example2() ; STEP BY STEP FUNCTION
While 1
Switch GUIGetMsg()
Case $1;     STEP 1
Return
Case $1;     STEP 2
MsgBox(0, '', 1)
Case $GUI_EVENT_CLOSE
ExitLoop
Case $1;     STEP 3
Return
EndSwitch
WEnd
EndFunc

    #Region - Any             description1              ; comment #1         
    #EndRegion

    #Region - Any             description2                  ; comment #2         
    #EndRegion

    #Region - Any             dscription              ; comment #3         
    #EndRegion

    #Region - Any             dscription                    ; comment #4         
    #EndRegion

#Tidy_ILC_Pos=-1                      ; strip space between "code end" and "comment" to single space (old behavior)
Func SomeFunction1()                ;  TEST 1
EndFunc

Func SomeFunction2()           ; TEST 2
EndFunc

Func SomeFunction3()      ; TEST 3
EndFunc

 

REMARKS:
This testing script is intended for testing NEW TIDY FEATURE, it is not intended to run nor testing with Au3Check tools.

Regards,
mLipok

EDIT: To bo sure that you will see what is doing with NonBreakingSpace, I attach this testing au3 file test _NBS_6.au3

 

and here are screenshots

HOW TO VIEW NBS IN SciTE:
image.png.436dcb47643e83317fc75430c45e7b56.png

 BEFORE USING TIDY:
image.thumb.png.19a5d1607a0b7b1380735436d8b7e7d6.png

AFTER USING TIDY:

image.thumb.png.e350f2f29dc002c517465f6bb42fd482.png

test _NBS_6.au3

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

btw.
For testing use also recent beta files:

https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/AutoIt3Wrapper.au3

https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/SciTE.exe

https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/SciLexer.dll

https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/tidy.ini

REMARKS: remember to make copy of this files (yours current version) before you replace them with this beta versions.

 

Edited by mLipok
added link to beta SciTE.exe

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

@Jos I found one problem with #cs <> #ce blocks

Just try to tidy this code few times:

#cs ; comment for #CE
    Func _CommentedFunction()
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
        Next
    EndFunc     ;==>_CommentedFunction
#CE ; comment for #CE

the effect will be like this:

#cs ; comment for #CE
                Func _CommentedFunction()
                    For $i =1 To 10
                        ; any code
                        ; any code
                        ; any code
                    Next
                EndFunc     ;==>_CommentedFunction
#CE ; comment for #CE

It look like that TIDY add new TAB each time.

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
1 hour ago, mLipok said:

For testing use also recent beta files:

They aren't really needed for testing, as those are more cosmetic changes for AutoIt3Wrapper.au3 and SciLexer.dll.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers
1 hour ago, mLipok said:

It look like that TIDY add new TAB each time.

Doesn't do that for me when I cut&paste the code from the post. Can you attach the file to ensure I have the same type of whitespace?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

19 minutes ago, Jos said:

Doesn't do that for me when I cut&paste the code from the post. Can you attach the file to ensure I have the same type of whitespace?

Jos

test _NBS_7.au3

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

Ah, found the reason why it didn't cause issues for me. I had this in Tidy.ini

Skip_commentblock=0

As the default is now  1, and when set to 1 it causes the issue you see.
Will have a look now.

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Fix v 18.708.9999.10 uploaded to dev for: 

2 hours ago, mLipok said:

It look like that TIDY add new TAB each time.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

fixed.... but not this following case:

Func _CommentedFunction()
#cs ; comment for #CE
    For $i =1 To 10
        ; any code
        ; any code
        ; any code
    Next
#ce ; comment for #CE
EndFunc   ;==>_CommentedFunction

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers

unbelievable how many scenarios need to be considered. :) 
Should be (better) Fixed v 18.708.9999.11, uploaded to Dev.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

next scenario :)

#Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50

Func _CommentedFunction()
    #cs ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
    Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
#CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
#CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    While 1
        #CS ; comment for #CE
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
        Next
            #CE ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    While 1
        #CS ; comment for #CE
    For $i =1 To 10
        ; any code
                ; any code - not well positioned should keep the same place
        ; any code
    Next
#CE ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

After TIDY I think this should look like:

#Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50

Func _CommentedFunction()
    #cs ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
    Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    #CS ; comment for #CE
For $i =1 To 10
    ; any code
    ; any code
    ; any code
Next
    #CE ; comment for #CE
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    While 1
        #CS ; comment for #CE
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
        Next
        #CE ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    While 1
        #CS ; comment for #CE
    For $i =1 To 10
        ; any code
                ; any code - not well positioned should keep the same place
        ; any code
    Next
        #CE ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

 

I mean INNER CONTENT should be keep the same positions as this is user choice

but OUTER CS/CE directives  should be positioned according to current SCOPE/INTERNALL CODE LEVEL.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

#AutoIt3Wrapper_Run_Tidy=y
#Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50
#Tidy_Parameters=/scb
#Tidy_Parameters=/Skip_commentblock
;~ #Tidy_Parameters=/scb=0
;~ #Tidy_Parameters=/Skip_commentblock=0
;~ #Tidy_Parameters=/scb=1
;~ #Tidy_Parameters=/Skip_commentblock=1

Func _CommentedFunction()
    While 1
    #cs ; comment for #CE
        For $i =1 To 10
            ; any code
            ; any code
            ; any code
        Next
        #ce ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

Func _CommentedFunction()
    While 1
        #cs ; comment for #CE
    For $i =1 To 10
        ; any code
                ; any code - not well positioned should keep the same place
        ; any code
    Next
    #ce ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

as you can see I try few #Tidy_Parameters settings .

I wonder how to properly disable this feature by using paramters ? As I see I'm doing something wrong with disabling this feature.

13 minutes ago, Jos said:

.. and keep the test scripts a small as possible? :) 

When you mention about scenarios, I start thinking about scenarios, and I think this was a complete list of possible scenarios, at least the ones that I managed to come up with.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
5 minutes ago, mLipok said:

I wonder how to properly disable this feature by using paramters ?

good point... that is why the default as for Skip_CommentBlock was 0 as the directive doesn't accept options and simply sets it to 1. Will change the default back to 0 for now and might retink the directivenames.

7 minutes ago, mLipok said:

When you mention about scenarios, I start thinking about scenarios, and I think this was a complete list of possible scenarios, at least the ones that I managed to come up with.

Part of that story was also to make things as small as possible, not all inclusive, which overwhelms the recipient. ;)

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

30 minutes ago, mLipok said:

I mean INNER CONTENT should be keep the same positions as this is user choice

but OUTER CS/CE directives  should be positioned according to current SCOPE/INTERNALL CODE LEVEL.

#AutoIt3Wrapper_Run_Tidy=y
#Tidy_ILC_Pos=50 ; preset "InLineComment_Pos" to column #50
#Tidy_Parameters=/scb
#Tidy_Parameters=/Skip_commentblock
;~ #Tidy_Parameters=/scb=0
;~ #Tidy_Parameters=/Skip_commentblock=0
;~ #Tidy_Parameters=/scb=1
;~ #Tidy_Parameters=/Skip_commentblock=1

Func _CommentedFunction()
    While 1
    While 1
    While 1
    While 1
        For $i To 10
        Next
        ConsoleWrite("! test" & @CRLF)
        FileWrite('log.txt','test')
        #cs ; comment for #CE
    For $i =1 To 10
        ; any code
                ; any code - not well positioned should keep the same place
        ; any code
    Next
    #CE ; comment for #CE
    WEnd
    WEnd
    WEnd
    WEnd
EndFunc   ;==>_CommentedFunction

image.thumb.png.cfa97d4a1a2d4e6839fdd90dc7b878e5.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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
Link to comment
Share on other sites

  • Developers
9 minutes ago, mLipok said:

I mean INNER CONTENT should be keep the same positions as this is user choice

but OUTER CS/CE directives  should be positioned according to current SCOPE/INTERNALL CODE LEVEL.

Ok you want the #CS/#CE not be part of the commentblock and still indent them with the other code. 
That doesn't make sense to me as those 2 lines are really part of the commentblock and thus should not be touched when Skip_Commentblock is active.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

so maybe lik this:

image.thumb.png.9f945d25417c0724514db2d9cf555f08.png

EDIT:

I mean \Skip_commentblock=0 should also do not touch user specyfic positionning, but only move entire block (look at pink vertical lines in my above screenshot)

EDIT 2:

image.png.abcc399382b33de080d07d4caf52b16d.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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Developers
24 minutes ago, mLipok said:

I mean \Skip_commentblock=0 should also do not touch user specyfic positionning, but only move entire block (look at pink vertical lines in my above screenshot)

I don't agree as those lines are standard linecomments which tidy like this:

Before

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
While 1
; any code
; any code
; any code
WEnd
EndFunc   ;==>_CommentedFunction

After:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
    While 1
        ; any code
        ; any code
        ; any code
    WEnd
EndFunc   ;==>_CommentedFunction

We could however consider changing the behavior totall leaving a commentblock alone when skip_commentblock is set by atleast lining it up with the indent of the code it is in.
Example: 
Before:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
While 1
#cs ; comment for #CE
For $i = 1 To 10
; any code
; any code
; any code
Next
#ce ; comment for #CE
WEnd
EndFunc   ;==>_CommentedFunction

Current After:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
    While 1
#cs ; comment for #CE
For $i = 1 To 10
; any code
; any code
; any code
Next
#ce ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

Proposed After:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
    While 1
        #cs ; comment for #CE
        For $i = 1 To 10
        ; any code
        ; any code
        ; any code
        Next
        #ce ; comment for #CE
    WEnd
EndFunc   ;==>_CommentedFunction

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

10 minutes ago, Jos said:

I don't agree as those lines are standard linecomments which tidy like this:

Before

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
While 1
; any code
; any code
; any code
WEnd
EndFunc   ;==>_CommentedFunction

After:

#Tidy_Parameters=/scb=1
Func _CommentedFunction()
    While 1
        ; any code
        ; any code
        ; any code
    WEnd
EndFunc   ;==>_CommentedFunction

We could however consider changing the behavior totall leaving a commentblock alone when skip_commentblock is set by atleast lining it up with the indent of the code it is in.

I thought that Skip_commentblock option was related only to #cs #ce but not to normaly comment which starts with semicolon.

 

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:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

  • Jos changed the title to Tidy major Update (2-Nov-2018)
  • Jos locked and unpinned this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...