AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

v1.0.48 released: Runs up to 3x as fast. Adds while-loop.
Goto page Previous  1, 2, 3
 
Reply to topic    AutoHotkey Community Forum Index -> Announcements
View previous topic :: View next topic  
Author Message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sat Apr 18, 2009 11:50 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
fincs



Joined: 05 May 2007
Posts: 1163
Location: Seville, Spain

PostPosted: Sat Apr 18, 2009 4:49 pm    Post subject: Reply with quote

Code:
A_ListLines := true
ListLinesOn(){
    Global
    ListLines On
    A_ListLines := true
}
ListLinesOff(){
    Global
    ListLines Off
    A_ListLines := false
}


There you go Cool
_________________
fincs
Get SciTE4AutoHotkey v3.0.00 (Release Candidate)
[My project list]
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sat Apr 18, 2009 6:28 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sat Apr 18, 2009 7:22 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun Apr 19, 2009 7:59 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sun May 03, 2009 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Fri Sep 25, 2009 3:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Fri Sep 25, 2009 7:07 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Sat Sep 26, 2009 12:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Sat Sep 26, 2009 2:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Announcements All times are GMT
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group