Jump to content
Sign in to follow this  
Jos

Tidy major Update (2-Nov-2018)

Recommended Posts

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.
  :)

Share this post


Link to post
Share on other sites

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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites

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.
  :)

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites
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.
  :)

Share this post


Link to post
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:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest beginning - communication with GitHub REST API Forum Rules *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for 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 *

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 * 

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 TaskScheduler

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 *

"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: 2019-10-01

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jos
      1/02/2018: Uploaded a new SciTe4AutoIt3.exe v19.102.1901.0 installer.
      This version contains the bugfix release for SciTE 4.1.2.
      There has been a major update for Tidy allowing now inline comments without them being shifted to the left by default.
      See this thread for the total story about the new behavior and the added options
      ==> SciTE4AutoIt3 v19.102.1901.0
      Enjoy,
      Jos

      Addition/Changes/Fixes in the current installer:

      -------------------------------------------------------------------------------------------------- 2-1-2019 *** Merged the SciTE v 4.1.2 by Neil Hodgson with our own version of SciTE. (Jos)     - Fixed regex issue for Alt+F in AutoItTools.lua     - Fixed another regex issue for several functions in AutoItTools.lua     - Fixed Header parameters now showing None when none are     - Fixed jump to function to also jump to the right Column again.     - Restored AutoItTools:Copy_BookMarks() functionality *** Updated AutoIt3Wrapper v19.102.1901.0 (Jos)     - 18.703.1808.1 renamed "#AutoIt3Wrapper_Au3Stripper_Stop_OnError" to "#AutoIt3Wrapper_Au3Stripper_OnError" with now as options S,C,F,Stop,Continue,ForceUse     - 18.708.1148.1 Added #include <WinAPIFiles.au3> back in the included file list to ensure backward compatibility.     - 18.708.1148.2 Added "Tidy_Stop_OnError" support to the AutoIt3Wrapper.INI file.                     Changed HiDPI settings for Win 10 compatibility.     - 18.708.1148.4 Added logic to be able to display Console Output of script that have #RequireAdmin while SciTE runs at normal level.     - 18.708.1148.5 Added support to allow to Stop Execution or Restart for scripts with #RequireAdmin while SciTE runs at normal level.                     It won't hang anymore when you reply No on the UAC and detect the elevated process didn;t start.     - 18.708.1148.6 Reverted HiDPI changes made in 18.708.1148.2 as problems are reported. needs investigation.     - 18.708.1148.7 Changed check for RequireAdmin AutoIt3Wrapper startup.     - 18.708.1148.8 Added #include <APIResConstants.au3> for backwards compatibility with AutoIt3 v3.3.14.x. *** Updated Au3Stripper v19.102.1901.0 (Jos)     - 18.708.1148.1 Fixed issue finding variable names on multiline statements     - 18.708.1148.2 Added check for ending \ in the AutoIt3Dir, and remove it when there, to avoid duplication of includes.     - recompiled with PellesC 6 to make it compatible with WinXP again. *** Updated SciTEConfig v19.102.1901.0 (Jos)     - 18.708.1148.1 Update to allow comments in *.SciTEConfig file lines. (JPM)                     This update includes the updated shemes to allow changing between them. *** Updated Tidy v19.102.1901.0 (Jos)     - 18.708.1148.1: Fix bug handling Directivelines ending with continuation character     - 18.708.1148.2: Fixed indentation when a "None breaking space"(C2A0) character is used in a UTF file.     - 18.708.1148.3: Fix bug when a continuation line starts with +x, where is would add a space between +- and number.     - 18.708.9999.x: Rewrite of some internal code to allow inlinecomments to remain at their current position.                       Details can be found in this post: https://www.autoitscript.com/forum/topic/196221-tidy-major-update-27-10-requesting-help-with-testing/     - 18.708.9999.22: Released to Beta.     - 18.708.9999.23: Added option to totally skip commentblocks so now the options are:                         #Tidy_Parameters=/tcb=0         =>only indent the whole commentblock  (default)                                          /tcb or /tcb=1 =>Tidy inside commentblock                                          /tcb=-1        =>leave whole commentbock alone                        Tidy.INI:#--> Tidy commentblock 0=only indent the whole commentblock  (default=0)                                 #                      1=Tidy inside commentblock                                 #                     -1=leave whole commentbock alone                                 Tidy_commentblock=0     - 18.708.9999.24: Added check for ending \ in the AutoIt3Dir and remove it when there.     - recompiled with PellesC 6 to make it compatible with WinXP again. --------------------------------------------------------------------------------------------------
      ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check the online documentation for an overview of all extra's you get with this installer.
    • By Jos
      7/8/2018: Uploaded a new SciTe4AutoIt3.exe v18.708.1148.0 installer.
      It has been over a year since the last update of the full SciTE4AutoIt3 installer whch mainly had to do with the fact that Neil was moving toward v4 of SciTE and I wanted to wait for a stable version.
      Any help with testing this version before general release is appreciated.
      Also any feedback is welcome in caseI missed something or suggestions for improvement before releasing.
      ==> SciTE4AutoIt3 v18.708.1148.0
      Enjoy,
      Jos

      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 8-7-2018 *** Merged the SciTE v 4.1.0 by Neil Hodgson with our own version of SciTE. (Jos)     This is a major change from the previous version so ensure you update all files including LUA or else you will get errors!     - SciLexer au3: Fixed issues with nested CommentBlocks not always showing the correct color.     - SciLexer au3: Change any line starting with # and no recognised keyword to be shown with the Pre-Processor in stead of default.     - Changed Shortcut for AU3INFO to Ctrl+Shift+F6.     - Moved the session restore logic for (save.session.advanced=1)into SciTE in stead of LoadSession.lua as that was clearing the recent files list of the last session       when opening a file by double cliking it. This is fixed with this change.       Default remains 0 so when a file is double clicked the last session isn't restored unless you add this to SciTEuser.properties:       "save.session.advanced=1"     - updated Tools.lua replacing [s%] with [ /t] to avoid empty lines being stripped by those functions. (Thanks Enyby) *** Updated AutoIt3Wrapper v18.708.1148.0 (Jos)     - 17.224.935.1 Added /autoit3dir to au3stripper commandline, when provided to AutoIt3Wrapper., to ensure the included files are for the correct AutoIt3 directory     - 17.224.935.2 Added directives:          #AutoIt3Wrapper_Res_CompanyName=          ;Company field          #AutoIt3Wrapper_Res_LegalTrademarks=      ;Trademark field     - 17.224.935.5 Fixed Versioning when files contain backets ->  ()     - 17.224.935.6 Added support for :          #AutoIt3Wrapper_Au3stripper_Stop_OnError=        ;(Y/N) Continue/Stop on Warnings.(Default=N)     - 17.224.935.7 added INI support for:           [Other]            Au3Stripper_Stop_OnError=n     - 17.224.935.10 Minor changes in console messages     - 17.224.935.11 Modifications from JPM:         - add #AutpIt3Wrapper_Res_Cursor_Add         - "clean" a little bit AutoIt3Wrapper.au3 *** Updated Au3Stripper v18.708.1148.0 (Jos)     - 17.224.935.1 Fixed crash when an include file contains longer record than 4096 characters.     - 17.224.935.2 Changed /rsln to replace @ScriptLineNumber in the Master script with "XXX/YYY". XXX is the master script linenumber, YYY is the Merged script linenumber.     - 17.224.935.3 Fixed issue detecting #cs #ce when a space was missing after the directive.     - 17.224.935.4 Changed Close/Open logic for Tracelog to (hopefully) avoid the hardcrash.     - 17.224.935.5 improved speed avoiding rereading include files to determine the max rec len.     - 17.224.935.6 improved speed by re-coding the check for long records.     - 17.224.935.7 Made sure the returncode is the highest from all iterations in stead of the last iteration.     - 17.224.935.8 fix for reported bug: https://www.autoitscript.com/trac/autoit/ticket/3623#comment:4     - 17.224.935.9 added support for #autoit3wrapper_autoit3dir     - 17.224.935.10 Fixed support for #autoit3wrapper_autoit3dir when followed by linecomment                     Stop processing when include file isn't found.     - 18.624.1847.1 strip the leading and trailing double quotes from the autoit3dir directive to avoid an error when they are specified.     - 18.624.1847.2 Fixed Hardcrash in the Include logic     - 18.624.1847.3 Fixed Hardcrash in Func stripping logic by enlarging the base table size     - 18.702.1556.1 Fixed regression bug with the Translate option.     - 18.703.1808.2 Fixed regression bug with the Stripping FUNC logic for the first found FUNC. *** Updated SciTEConfig v18.708.1148.0 (Jos)     - 17.224.935.1 No updates *** Updated Tidy v18.708.1148.0 (Jos)     - 17.224.935.1 Added option  to copy comments from #CS to #CE. Default is to copy the comments.                    Added Tidy Parameters:  /Skip_CE_Comment or /scec will skip this copy action                    Added INI option:                      * * *  Add comment to #CE/#CommentEnd and make it the same as the #CS/CommentStart Comments.                      ce_comment=1     - 17.224.935.2 Fix issue with Copy comments on comment start - end     - 17.224.935.4 Fix another issue with Copy comments on comment start - end -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check the online documentation for an overview of all extra's you get with this installer.
    • By gillesg
      Hello,
       
      Is there a way to change the backup pattern for Tidy ?
      Actually it goes by <Myfile>.au3 becomes <MyFile>_old<x>.au3.
      I would like it to be <Myfile>.au3 becomes <MyFile> v<x>.au3.
      Thanks.
       
      Gilles
       
    • By Jos
      Merged the SciTE 3.7.3 source into our version and several other changes and fixes to the supporting utilities.
      Enjoy,
      Jos
      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 24-2-2017 *** Merged the SciTE v 3.7.3 by Neil Hodgson with our own version of SciTE. (Jos) *** Updated AutoIt3Wrapper v17.224.935.0 (Jos)     - 16.612.1119.1 Fixed #AutoIt3Wrapper_Run_Stop_OnError=N, avoiding to stop even when No or not  specified.     - 16.612.1119.2 Fixed #AutoIt3Wrapper_Run_Stop_OnError=N, avoiding to stop even when No or not  specified.     - 16.612.1119.3 Added warning for #AutoIt3Wrapper_UseX64 in case #pragma(out,..)  is used. *** Updated Au3Stripper v17.224.935.0 (Jos)     - 16.612.1119.1 Fixed issue which sometimes was stripping a global const incorrectly     - 16.612.1119.2 Fixed /maxiterations parameter not recognised     - 16.612.1119.3 Fixed increased the max #Au3Stripper_Ignore_Variables to 500 and for #Au3Stripper_Ignore_Funcs to 200     - 16.612.1119.4 Fixed regression introduced in 16.612.1119.1 *** Updated SciTEConfig v17.224.935.0 (Jos)     - 16.306.1119.1 ... *** Updated Tidy v17.224.935.0 (Jos)     - 16.612.1119.1: Fixed Sort_Func function bug when the source contains a BOM. *** Updated CodewiZard v1.5.4.0 (Cyberyeye)     - Fix Icon Ressource Number for Messagebox Tab & ToolTip Tab     - Check/Fix missing includes using AutoIt3Wrapper_Add_Constants=y     - Added Opt("MustDeclareVars", 1) to fix undeclared variables     - Replaced msgbox() magic number by constant name     - Added GUISetIcon var (au3.ico)     - Removed unusefull old AutoIt3Wrapper directive *** Updated Abbreviations (mLipok)     - Updated au3abbrev.properties and helpfile page. --------------------------------------------------------------------------------------------------
      ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check  the online documentation for an overview of all extra's you get with this installer.
       
×
×
  • Create New...