| View previous topic :: View next topic |
| Author |
Message |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sat Apr 18, 2009 11:50 am Post subject: |
|
|
| jenn wrote: | ...how about a "A_ListLines" variable?
I have started using ListLines On/Off in functions where I either want to see or not see the function lines. The obvious problem is that when exiting a function that uses this, there is no current way to know what the ListLines On/Off state was when entering the function. |
I had considered adding A_ListLines; but since On/Off is a debugging feature and probably won't be commonly used, it seemed like it would add more clutter to the documentation than it was worth. (The list of built-in variables is already distractingly and dauntingly long.) |
|
| Back to top |
|
 |
fincs
Joined: 05 May 2007 Posts: 1163 Location: Seville, Spain
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sat Apr 18, 2009 6:28 pm Post subject: |
|
|
Thanks; I've added it to the documentation. I hope that will be enough for anyone who needs A_ListLines.
I changed it a little to be more consistent with some of the other A_xxx variables. The following would be included near the top of a script: | Code: | A_ListLines := "On"
ListLinesOn()
{
ListLines On
Global A_ListLines := "On"
}
ListLinesOff()
{
ListLines Off
Global A_ListLines := "Off"
} |
Last edited by Chris on Sat Apr 18, 2009 6:50 pm; edited 1 time in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sat Apr 18, 2009 7:22 pm Post subject: |
|
|
Oops, I just realized it's not quite the same as a built-in variable because every function that needs to look at A_ListLines would first have to declare it as global. Maybe this is a little better: | Code: | ListLines(PassTrueToTurnOnOrFalseToTurnOff) ; Returns the previous setting of ListLines (prior to this call).
{
static sListLines := true ; The starting default for all scripts is "ListLines On".
ListLines % PassTrueToTurnOnOrFalseToTurnOff ? "On" : "Off" ; Execute ListLines unconditionally to omit the lines executed below from the log.
ListLines_prev := sListLines
sListLines := PassTrueToTurnOnOrFalseToTurnOff
return ListLines_prev
} |
| Code: | ; To use the above function:
prev_ListLines := ListLines(false) ; Turn off ListLines temporarily.
; ...
ListLines(prev_ListLines) ; Restore ListLines to its previous setting. |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun Apr 19, 2009 7:59 pm Post subject: |
|
|
Here are the changes for v1.0.48.02:
Changed and fixed Gosub and GroupActivate so that when a function calls an external/public subroutine, that subroutine will treat all dynamic variables as globals, and will have outside-of-function GUI behavior. [thanks kenomby & Lexikos]
Improved performance of True/False/A_EventInfo in expressions by treating them as integers vs. strings. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sun May 03, 2009 6:41 pm Post subject: |
|
|
Here are the changes for v1.0.48.03:
Fixed "ListLines On" not to erase the most recent log entry in the line history. [thanks Lexikos]
Fixed ListView to respond properly to mouse dragging when timers are running. [thanks Solar]
Fixed key-up hotkeys so that if one is created while its key is being held down, the release of the key doesn't trigger the wrong hotkey. [thanks Peter & engunneer] |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Fri Sep 25, 2009 3:15 pm Post subject: |
|
|
Here are the changes for v1.0.48.04 (this is mostly a bug-fix release, and most of the fixes are minor or rare except the first one below):
Fixed StringSplit to work properly inside functions of compiled scripts (broken by 1.0.35.01). [thanks engunneer & Lexikos]
Fixed SendPlay not to wait for the release of the Windows key prior to sending an "L" keystroke (broken by 1.0.48.01). [thanks Lexikos]
Fixed A_EndChar to be valid when the B0 option is present, and to be empty when there is no ending character (broken by 1.0.44.09). [thanks Al2000]
Fixed FormatTime to yield a valid time of day even when the specified month is out-of-range (broken by 1.0.48.00). [thanks silveredge78]
Fixed FileCreateDir to support a leading backslash even when it is the only backslash; e.g. \dir. [thanks jaco0646]
Fixed GuiControl/GuiControlGet/Gui/SendMessage to work reliably even when they trigger a callback or OnMessage function. [thanks Lexikos]
Fixed RegExMatch() not to produce too few replacements when an empty-string match is followed by a non-empty-string match.
Changed "While()" to be recognized as a loop rather than a function. [thanks Crash&Burn]
Improved UrlDownloadToFile to support FTP and Gopher. [thanks Lexikos]
Improved the stdout/asterisk mode of FileAppend to write immediately rather than lazily to standard output. [thanks Lexikos]
Added full support for "if % expression". [thanks kenomby] |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Fri Sep 25, 2009 7:07 pm Post subject: |
|
|
| v1.0.48.05 fixes a crash of SendMessage and PostMessage when wParam or lParam is omitted (broken by 1.0.48.04). [thanks Lexikos] |
|
| Back to top |
|
 |
Laszlo
Joined: 14 Feb 2005 Posts: 4710 Location: Boulder, CO
|
Posted: Sat Sep 26, 2009 12:28 am Post subject: |
|
|
Well, scripts get broken with the new prohibition of “while” as function name. I am not so sure that while(condition) is important to be recognized as loop. One of my broken scripts is below, but a there are more examples: | Code: | while("f","g")
while(cond,do) {
Loop
if %cond%(A_Index)
%do%(A_Index)
else Return
}
f(x) {
Return x<3
}
g(x) {
MsgBox %x%
} |
It is also inconsistent, because replacing “while” with “loop” still works as function. The user would need a list of prohibited names, which cannot be used as function names, and maybe warnings. The following still works: | Code: | loop("f","g")
loop(cond,do) {
while %cond%(A_Index)
%do%(A_Index)
}
f(x) {
Return x<3
}
g(x) {
MsgBox %x%
} |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Sat Sep 26, 2009 2:13 am Post subject: |
|
|
Sorry for the annoyance caused by this.
It was changed because I and those discussing it at the topic below thought that it would be very rarely used as a function (but apparently it's not so rare).
More imporantly, some people who are used to other programming languages have a deeply-ingrained habit to write if() and while() [without spaces]. Since if() was already supported as "not-a-function", it seemed reasonable and consistent to do the same for while().
The original topic is www.autohotkey.com/forum/viewtopic.php?t=47232, in which a lot of people expressed support for the change; and no one really said anything against it. |
|
| Back to top |
|
 |
|