Page 1 of 1

A_ListLines not compatible with ListLines.

Posted: 27 Jul 2018, 15:24
by CerpinTaxt
A_ListLines contains a boolean but ListLines doesn't accept a boolean. So that means when somebody wants to save and later restore the settings, they can't use something like this:

Code: Select all

O_ListLines := A_ListLines

; code

ListLines, % O_ListLines
But instead they have to do something like this:

Code: Select all

O_ListLines := ( A_ListLines ? "On" : "Off" )

; code

ListLines, % O_ListLines
My first example is what works with A_DetectHiddenWindows, A_AutoTrim etc. So whether it's changing ListLines to accept a boolean or changing A_ListLines to contain "On"/"Off" instead of a bool, I feel like consistency would be good.

Re: A_ListLines not compatible with ListLines.

Posted: 27 Jul 2018, 16:34
by lexikos
Boolean is generally more useful, so AutoHotkey v2-alpha accepts boolean in every case where On/Off is allowed. A_ListLines was added more recently than the other settings, so it uses boolean. However, there are some variables that haven't been changed yet, and I may remove On/Off entirely.

Even if we wanted A_ListLines to return On/Off, it's too late for v1; changing it now would break scripts. However, changing all commands to accept boolean where On/Off is allowed would be fine.

Re: A_ListLines not compatible with ListLines.

Posted: 27 Jul 2018, 19:12
by CerpinTaxt
lexikos wrote:Boolean is generally more useful, so AutoHotkey v2-alpha accepts boolean in every case where On/Off is allowed. A_ListLines was added more recently than the other settings, so it uses boolean. However, there are some variables that haven't been changed yet, and I may remove On/Off entirely.

Even if we wanted A_ListLines to return On/Off, it's too late for v1; changing it now would break scripts. However, changing all commands to accept boolean where On/Off is allowed would be fine.
I think booleans are the better option as well, and I think changing commands which accept On/Off to also accept booleans would be perfect. I just happened to be using the code I listed in my first example and was baffled as to why ListLines kept appearing when all I wanted to do was set it back to its previous value.

Re: A_ListLines not compatible with ListLines.

Posted: 04 Aug 2018, 22:21
by GeekDude
VismundCygnus wrote:I think booleans are the better option as well, and I think changing commands which accept On/Off to also accept booleans would be perfect.
I agree :thumbup: