Jump to content

A wish: Comments within statements


Recommended Posts

Now you can't write this:

$sPath = _CFF_Choose('Choose drive or directory', _ ; $sTitle
Default, _  ; $iW
Default, _  ; $iH
Default, _  ; $iX
Default, _  ; $iY
'',      _  ; $root
'*.txt|*.jpg|*.vbs', _  ; $sMask: include|exclude|exclude_folders
2, _        ; $iDisplay: Entire folder tree only - no files.  Doubleclicks will expand, not select, item
-1, _       ; $iMultiple: Multiple selections using checkboxes
$gui _      ; parent
)

You can write:

$sPath = _CFF_Choose('Choose drive or directory',Default,Default,Default,Default,"",'','*.txt|*.jpg|*.vbs',2,-1,$gui)

But it is all too easy to write

$sPath = _CFF_Choose('Choose drive or directory',Default,Default,Default,"",'','*.txt|*.jpg|*.vbs',2,-1,$gui)

If the function only has 3 or 4 parameters, it is easy enough to keep track of which is which.  But if there are more, one ends up counting them, and if you get the count off, you wonder why the function doesn't behave as you expect. You end up wasting time, thinking that your error is complex, when it isn't. This can particularly  problematic where a function has optional parameters.

When I have a problem, I think of there being too many alligators in my pond. By allowing the format suggested above, one alligator could be no more: the user would not need to depend on his count of parameters to make sure that he has the intended value for a particular parameter.

OK, it true that you can now write

Local $iW = Default,$iH=Default ...
$sPath = _CFF_Choose('Choose drive or directory',Default,Default,Default,Default,$root ...

but I find this to be a bit of a pain.

I am thinking that adding this feature to AutoIt would be fairly easily. Perhaps I am mistaken. Back when I used Visual Basic, it could handle the format I am suggesting.

Thoughts?

Edited by c.haslam
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

  • Moderators

c.haslam,

Quote

Now you can't write this:

Oh yes you can - I have just tried. Did you?

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I had tried it, but ...

You are correct: my code, with nothing else in the script,  passes the syntax check. I had something else wrong in my longer script.

I had it in my mind that in-statement comments don't work. I was probably doing this:

$sPath = _CFF_Choose('Choose drive or directory',  ; $sTitle _
Default,    ; $iW  _
Default,    ; $iH  _
Default,    ; $iX  _
Default,    ; $iY  _
'',         ; $root _
'*.txt|*.jpg|*.vbs',    ; $sMask: include|exclude|exclude_folders  _
2,      ; $iDisplay: Entire folder tree only - no files.  Doubleclicks will expand, not select, item  _
-1,     ; $iMultiple: Multiple selections using checkboxes  _
$gui        ; parent  _
)

Here the _s are taken as part of the comments

My error

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

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

Create an account

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

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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