Jump to content

Recommended Posts

Posted (edited)

How I see in

http://www.autoitscript.com/autoit3/scite/docs/Tidy.html

There is an option that is enabled by default.

  Quote
 * * *  Add comment to EndFunc statement e.g. "EndFunc   ;==>UDF_Name"
#~ endfunc_comment=1

 

I have to honestly say that I like it.

Then I began to wonder:

Is a similar functionality can be added to other functions available in AutoIT.

Here is an example of what would be the result of my proposal. 
#include <MsgBoxConstants.au3>
Func _Test_comment_1() ; comment example for Func and EndFunc
    Local $sString = ""
    If $sString > 0 Then ; comment using IF Then
        MsgBox($MB_SYSTEMMODAL, "", "Value is positive.")
    ElseIf $sString < 0 Then
        MsgBox($MB_SYSTEMMODAL, "", "Value is negative.")
    Else ; comment using IF Then
        If StringIsXDigit($sString) Then
            MsgBox($MB_SYSTEMMODAL, "", "Value might be hexadecimal!")
        Else
            MsgBox($MB_SYSTEMMODAL, "", "Value is a string.")
        EndIf
    EndIf ; comment using IF Then


    Local $sMsg = ""
    Switch @HOUR ; comment using switch
        Case 6 To 11
            $sMsg = "Good Morning"
        Case 12 To 17
            $sMsg = "Good Afternoon"
        Case 18 To 21
            $sMsg = "Good Evening"
        Case Else
            $sMsg = "What are you still doing up?"
    EndSwitch ; comment using switch

    Local $iValue = 0
    Local $sBlank = "Test"
    Select ; comment using Select
        Case $iValue = 1
            MsgBox($MB_SYSTEMMODAL, "", "The first expression was True.")
        Case $sBlank = "Test"
            MsgBox($MB_SYSTEMMODAL, "", "The second expression was True")
        Case Else ; If nothing matches then execute the following.
            MsgBox($MB_SYSTEMMODAL, "", "No preceding case was True.")
    EndSelect ; comment using Select



    Local $oExcel = ObjCreate("Excel.Application")
    $oExcel.visible = 1
    $oExcel.workbooks.add

    With $oExcel.activesheet ; comment using With
        .cells(2, 2).value = 1
        .range("A1:B2").clear
    EndWith ; comment using With

    Local $i = 0
    While $i <= 10 ; comment using While
        MsgBox($MB_SYSTEMMODAL, "", "Value of $i is: " & $i)
        $i = $i + 1
    WEnd ; comment using While


    Do ; comment using Do Until
        ExitLop

    Until 1 ; comment using Do Until

EndFunc   ;==>_Test_comment_1

I think it would be very useful especially in the case when the functions are nested.

 

like here

If False Then ; Comment assigned to External "IF THEN"
    ;.....
    If True Then ; Comment assigned to Central "IF THEN"
        ;.....
    Else ; Comment assigned to Central "IF THEN"
        ;.....
        If True Then ; Comment assigned to Internal "IF THEN"
            ;.....
        Else ; Comment assigned to Internal "IF THEN"
            ;.....
        EndIf ; Comment assigned to Internal "IF THEN"
        ;.....
    EndIf ; Comment assigned to Central "IF THEN"
    ;.....
Else ; Comment assigned to External "IF THEN"
    ;.....
EndIf ; Comment assigned to External "IF THEN"

Jos: What You thik about that ?

 

EDIT: add tag to the thread

Edited by mlipok

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

  Reveal hidden contents

Signature last update: 2023-04-24

  • Replies 59
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

I believe some already requested this.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

Honestly I personally don't see a good use for that. But I count for 1, not 1000.

  Reveal hidden contents

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Posted
  On 8/18/2013 at 8:19 PM, jchd said:

Honestly I personally don't see a good use for that. But I count for 1, not 1000.

Add 2 to that 1.

UDF List:

  Reveal hidden contents

Updated: 22/04/2018

Posted

I see that I am in opposition  :

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
You're right.
I used what I did, seriously considering changing habits.
 
But for now considering possible solutions.
In this how to say write your own plug-ins.
But not just to add comments.
First of all, for the management of variable names inside of all my scripts.

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

  On 8/18/2013 at 8:19 PM, jchd said:

Honestly I personally don't see a good use for that. But I count for 1, not 1000.

Add 3 to that 1.

Oh, it makes me think that we could add a manner on how to add comments in the Best Coding Practices wiki.

If anyone agree with me?

The comments are added before what you are reffering to, not at the end (except for a little note or to tell what it should return).

e.g:

; If a and b are True then do stuff
If $a And $b Then
;do stuff
EndIf

;so the tidy won't do:
; If a and b are True then do stuff
If $a And $b Then
;do stuff
; If a and be are True then do stuff
EndIf
Furthermore, if your script is tidied you shouldn't be lost in your script.

Remember: Too much nested Ifs can surely be merged.

Posted
  On 8/19/2013 at 8:33 AM, FireFox said:

Add 3 to that 1.

Oh, it makes me think that we could add a manner on how to add comments in the Best Coding Practices wiki.
If anyone agree with me?

I Agree

 

  On 8/19/2013 at 8:33 AM, FireFox said:

The comments are added before what you are reffering to, not at the end (except for a little note or to tell what it should return).

 

  On 8/19/2013 at 8:33 AM, FireFox said:

Furthermore, if your script is tidied you shouldn't be lost in your script.

  
  On 8/19/2013 at 8:33 AM, FireFox said:

Remember: Too much nested Ifs can surely be merged.

 

Thanks for these three valuable comments.

 

and as I say:

I used what I did, seriously considering changing habits.

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Quite an interesting idea.

But I would like to expand it.
Not only for the function EndIf Else If, but for all I mentioned in the first post.

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

Do you mean "code folding" , otherwise I do not know something or do not understand.

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 8/19/2013 at 11:43 AM, mlipok said:

Do you mean "code folding" , otherwise I do not know something or do not understand.

Yeah that's what I meant :)
Posted (edited)
There are two options.
Ignore [user] signature.
Ignore all the signatures.
 
These options are available only for the first post on the page of the thread.
 
Now everything is clear.
 
EDIT:
I'm sorry this is not a statement to this thread
Edited by mlipok

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

Whether the "code folding" is an integral part of SciTE , or is a supplement created by Jos EDIT: ?

Edited by mlipok

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

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
Finally, it occurred to me what is the source of my report.
In short, the idea is that "code folding" principle works well.
But in some cases would require a different functionality.
 
I'll try to describe reasonably well, but it will take some 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:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)

One thing could be useful: retain folds (natives and also for #region) upon editor exit.

Edited by FireFox
Posted
  On 8/19/2013 at 1:36 PM, FireFox said:

One thing could be useful: retain folds (natives and also for #region) upon editor exit.

I agree, but I do not know whether it would be feasible.

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

  Reveal hidden contents

Signature last update: 2023-04-24

Guest
This topic is now closed to further replies.
×
×
  • Create New...