AutoHotkey v2 alpha (UPDATES)

Discuss the future of the AutoHotkey language
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


24 Jan 2018, 05:35


Fixed methods [broken by v2.0-a085].
Changed `::: in a hotstring to escape only one colon, not two.
Changed hotstrings to split at the first ::, not the last. Note that with an odd number of consecutive colons, the previous behaviour did not consider the final colon as part of a pair. For example, ::1:::a included colon in the replacement while ::2::::b included double-colon in the trigger.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


27 Jan 2018, 21:20

Changes to ([{ continuation:

Fixed detection of missing close-quote in continuation expressions.
Fixed comment sections and line continuation in or following ([{ continuation.
Fixed ([{ continuation for hotkeys with same-line action.
Fixed ([{ continuation for #If.

Changed ([{ continuation to allow continuation sections. The original intention was consistency between ( and [/{, but it didn't work out since continuation sections are handled before ([{ continuation (so were already "permitted" up to the first ([{-unbalanced line).

Improved detection of OTB vs. {} line continuation. It should now be smart enough to allow line continuation wherever an object literal is valid but OTB is not (except for While/If {, which are [still] treated as errors due to the missing parameter).

Other changes:

Improved continuation sections to automatically escape quotes if the continuation section is inside a quoted string, and not escape them otherwise. Removed the Quotes option.

Changed continuation sections to add space if first line ends with word.

Revised handling of xxx() where xxx is a control flow statement name.
  • All control flow statements allow () around their parameter list.
  • If at the start of a line, it is never a function call/definition.
Removed #IfWin and optimized #If Win().

Other bug fixes:

Fixed directives to not permit a comma after the directive name. The comma was treated as part of the parameter's value in most cases.
Fixed quotes being put around vars in ListLines/error text.
Fixed Hotkey() to throw correctly when it fails.
Fixed Hotkey() to allow Label to be omitted.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


29 Jan 2018, 02:41

Fixed else{, try{ and finally{.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


18 Feb 2018, 06:02

Fixed WinGetClientPos to return size, not bottom-right position.
Fixed unary operators following an empty parameter.
Merged v1.1.28.00.
Made A_ListLines writable.
Fixed properties like "x{" and "xx{" in class definitions.
Changed stdin (*) scripts to not prepend working dir to title or A_ScriptFullPath.
Changed threads to execute minimum one line before first interruption.
Changed default thread uninterruptibility to 17ms. Anything less can be virtually no time at all since GetTickCount() has a granularity of 15 or 16.
Removed Suspend("Permit") and added #SuspendExempt.
Removed obsolete checks for action type of thread's first line.
Fixed some issues with #If [broken by v2.0-a087].
Changed remapping to release mandatory modifiers, such as for ^a::b.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


26 Mar 2018, 05:25

Added nested functions, closures and fat arrow => functions.

Renamed RegisterCallback to CallbackCreate and changed to better utilize closures:
  • Added support for function objects.
  • Removed EventInfo parameter (use a closure or bound function instead).
  • Removed the special behaviour of variadic callback functions and added the & option (pass the address of the parameter list).
  • Added CallbackFree(Address), to free the callback memory and release the associated function object.
Changed IsFunc() and Func() to require a function name. Passing an object is now an error.

It is no longer possible to externally call a subroutine inside a function (local label). Nested functions provide the same benefits without the limitations. Specifically:
  • Changed SetTimer and Menu.Add to use only functions/objects, not labels.
  • Changed Hotkey and Hotstring to ignore local labels.
Improved handling of trailing blank parameters.

Optimized Func("LiteralName") to resolve the function name at load time (only applies to direct calls with a single plain quoted string).

Fixed the new Hotstring() function.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


30 Mar 2018, 23:30

Added the capability to name fat arrow functions. This also fixes crashes caused by previously invalid code like MsgBox() => expr.

Fixed => on a line following a label/hotkey/hotstring.
Fixed multi-level upvars (locals from outer-outer function).
Fixed := operator within a fat arrow function.
Fixed => in static class var initializers to not have an implicit this parameter.
Fixed => below if/else/loop/try/etc. to work without a block.
Debugger: Fixed stepping over return after a nested function.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


31 Mar 2018, 23:36

Fixed Hotkey("If", "Expression") [broken by 3e8c8e41 and f9822637].
Fixed Menu objects not being deleted automatically.
Fixed () => breaking the preceding func/var ref [broken by 94d7f6a9].
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


07 Apr 2018, 04:06

Fixed some issues with Menu object cleanup.

Replaced Menu.Standard with Menu.AddStandard().
  • Add normal menu items, which can be modified.
  • Don't create/destroy the menu to add the items.
Revised menu bar handling; added MenuBar type and MenuBarCreate().
  • Report errors (menu bar used as menu or vice versa).
  • Destroy only the menu itself when its object is deleted.
  • Change/remove submenu without destroying the old submenu.
Renamed Gui.Menu to Gui.MenuBar.

Changed &address-of to work with literal and temporary strings.
Changed Object.GetAddress(k) to allow Object[k] to be "".
Changed Object.GetAddress(k) to throw if no string is present.
Changed SendMessage/PostMessage to accept only integers.

Changed () => to be assume-global if not used inside a function.

Changed Gui object to be deleted automatically if not visible.
  • Don't count the program's internal reference to the object.
  • Destroy() when deleted.
  • AddRef() when shown with Show().
  • Release() when hidden with Show/Hide/Cancel/Submit() or by closing.
Merged v1.1.28.02.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


22 Apr 2018, 05:42

Improved error reporting for unbalanced ()/[]/{}.
Fixed detection of invalid v1 legacy assignments.
Fixed Func/DllCall optimization and OutputVar detection with ternary and short-circuit operators.
Split "Unknown property or method" into two messages.
Fixed return string_var optimization for vars which are upvars/downvars.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


29 Apr 2018, 05:25

Fixed Gui.MenuBar return value (previously not implemented).
Changed objects to use 64-bit integer keys on all builds.
Implemented some trivial optimizations to string key lookup and linear array indexing in objects.
Fixed () => x ? y := v : z.
Removed UseErrorLevel from Run/RunWait.
Changed Run/RunWait to always set A_LastError.
Converted RunWait, ClipWait, KeyWait and WinWait' to functions.
  • Never set ErrorLevel.
  • Return non-zero if condition was met (zero for timeout).
  • RunWait: return exit code.
  • WinWaitClose: set Last Found Window.
Changed math functions and operators to throw an exception instead of returning "" for errors.
Added type-conversion functions Float, Integer and String.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


07 May 2018, 06:25

Changed properties to handle only get/set, not call.
Fixed obj[-n].
Merge pull request #98 from nnnik/AutoHotkey_L
Divided [members of File object] into methods and properties and added errors
-Made `Seek`, `Tell` and `Close` methods
-Unkown Method Error when trying to call a property
-Too few/Too many parameters when calling a method with too few or too many parameters
-Invalid Use Error when trying to set a read only property
Removed File.Tell().
Replaced SendRaw/ControlSendRaw with SendText/ControlSendText.
Changed hotstrings with continuation sections to use {Text} vs. {Raw}.
Changed x.y(z) := v to be an error, not equivalent to x.y[z] := v.
Trivial maintenance (DllCall).
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


12 Jun 2018, 22:34

Changed ImageSearch to throw instead of setting ErrorLevel:=2.
Fixed validation of output vars preceded by another parameter.
Added runtime validation of output vars for built-in functions.
Fixed localization of for-loop variables which are aliases (ByRef, free variables in closures, and super-global variables where referenced by a function preceding the declaration).
Merged v1.1.29.01.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


11 Aug 2018, 21:13

Added ObjCount(Obj).
Changed SoundGet/A_DetectHidden'/A_StoreCapslockMode to return 0 or 1.
Fixed Object.SetCapacity(x,y,z) to use y as the new capacity, not z.
Fixed class body to disallow lone function calls.
Improve parsing of numeric literals to reduce code size and allow member access (with default meta-functions).
Revised error messages for syntax errors with . or illegal characters, and improved detection of the latter.
Changed Chr to throw if parameter is non-numeric or out of range.

Merged pull requests #104, #105 and #106 from HelgeffegleH/AutoHotkey_L:
  • Added binary operator !== and changed != to always be case-insensitive.
  • Removed the <> operator.
  • Added basic input validation for CallbackFree address parameter.
(The documentation for the operators was forgotten in this release.)
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


22 Aug 2018, 04:11

Merged v1.1.30.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


05 Oct 2018, 22:52

Merge pull request #111 from HelgeffegleH/AutoHotkey_L (validation of A_CoordMode).
Changed A_CoordMode to require a non-empty value on assignment.
Changed ComObjValue() and ComObjFlags() to require a valid ComObject.
Changed Func.IsOptional(n) and Func.IsByRef(n) to throw if n is invalid.
Changed usage of Control parameter with Control functions and SendMessage/PostMessage.
  • Can be a HWND (integer)
  • Can be an object with a HWND property
  • Mandatory in most cases
  • Omit to use target window itself (ahk_parent is removed)
  • Blank values are invalid (never default to topmost control)
Added ControlGetClassNN().
Changed ControlGetFocus() to return a HWND.
Changed "Script file not found" to respect /ErrorStdOut and exit code.
Replaced A_IPAddressX with SysGetIPAddresses().
Changed * (stdin) scripts to use A_InitialWorkingDir as A_ScriptDir.
Changed StrPut and StrGet to throw on failure, not return "" or 0.
Updated ImageSearch, PixelSearch and PixelGetColor.
  • ImageSearch and PixelSearch: return true if found.
  • Throw an exception on failure.
  • Do not set ErrorLevel.
Changed PixelSearch to default to Fast mode; added Slow option.

Fixed 64-bit keys in the debugger on 32-bit builds.
Fixed reliability of object keys on 32-bit builds.
Fixed __init/__delete causing misleading error line/stack trace.
Fixed hotkey-related crashes caused by erroneous ZeroMemory call.

Note: Specifying a window (WinTitle) by HWND still requires ahk_id for now. WinTitle will get similar treatment to Control in a future update.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


06 May 2019, 03:27

Merged pull requests from Helgef:
  • #117: Improved validation of Menu options.
  • #118: Changed ** (power) operator to throw an exception if both operands are zero.
  • #121: Disabled unquoted arg and return types for DllCall.
  • #124: Changed << and >> to throw an exception if the right-hand operand is outside of the range 0..63.
  • #126: Changed &var_containing_pure_number to prevent caching of its numeric string.
  • #127: Changed BoundFunc to prohibit calling with [].
  • #134: Fixed control option for relative offset placement to work with negative numbers.
  • #129: Changed float formatting to use the g specifier, which affects long numbers (improves readability, preserves values closer to zero, fixes truncation errors for very long numbers).
  • #108: Added StrCompare function (no documentation yet).
  • #130: Changed VarSetCapacity(var, -1) to show an error message and terminate the program if the variable is not null-terminated (in which case it may be unsafe to continue execution).
Removed Sort's F option and added a separate parameter to support function objects.
Fixed built-in objects to detect improper usage more consistently.
Changed RegExMatchObject syntax to remove ambiguity.
  • Value, Pos, Len, Name, Count and Mark are only methods, and are not accessible as properties.
  • o[n] is still shorthand for o.Value(n), but now does nothing else. Same for o.n, except that n is literal.
Improved DBGp support for properties of built-in objects.
Added support for obj.%name% and similar.
Added the __Item property to allow differentiating between x.y and x["y"].

Fixed Pic.Value:="" to not throw an exception.
Fixed script debugger to not trigger UseUnset warnings.
Fixed detection of function boundaries for goto/return validation.
Fixed Clipboard .= "string" discarding the previous value.
Fixed `s escape in hotstrings.
Fixed AutoHotkey objects to raise errors for unknown properties called via IDispatch.
Fixed TreeView.Add() to throw if an option is invalid.
Fixed Func.IsByRef() for built-in functions.
Removed ProgramFiles var again (erroneously restored by b9b520a9).
Fixed string-to-integer conversion to support scientific notation.
Fixed the inability of OnExit functions to prevent a non-persistent script from exiting.

Merged v1.1.30.03 plus some bug fixes.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


09 May 2019, 22:33

Added => for shorthand property and method definitions.
Added "Global", "Local" and "Static" as reserved words.
Added validation of code page identifiers.
Changed A_FileEncoding:= to allow numeric values without the CP prefix.
Changed ""["base"] to not access default base object; use "".base.
Changed x.y:=z and x[y]:=z to always the yield value of z.
Fixed A_ScriptHwnd to return an Integer.
Fixed crashes when debugging properties of a Gui with FocusedCtrl != "".
Fixed File.Seek(n) and File.Position:=n.
Other maintenance that shouldn't affect behaviour.
Posts: 6379
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos


12 May 2019, 19:08

Changed function calls to throw if too many parameters are passed.
Added fn(a,*) as a means to permit but not store surplus parameters.

Changed StrPut to return byte count rather than character count.

Updated docs/Object to reflect some of the planned changes.

Added BufferAlloc() and Buffer object.

Changed NumPut, NumGet, File.RawRead, File.RawWrite, StrPut and StrGet to allow passing a Buffer-like object; that is, any object with Ptr and Size properties. Optimizations are in place for the native Buffer object. Testing showed that passing a native Buffer object is as fast as passing a pointer.

I recommend reading the updated documentation for NumPut, NumGet, File.RawRead and File.RawWrite. Support for passing a variable to use as a buffer may be removed from these functions/methods. The general use of VarSetCapacity for binary data is to be discouraged.

Added a new mode to NumPut which allows a sequence of numbers to be written, as in NumPut("int", a, "ptr", b, buf). (NumPut's parameters can be compared to the input parameters of a DllCall, while NumGet's type parameter can be compared to DllCall's return type.) Currently the old syntax is also permitted, but it may be removed.

Changed DllCall Ptr args to allow passing any object with a Ptr property. An exception is thrown if an object is passed to any other type of arg, or if this property does not exist.

Changed FileRead(File, "RAW") to return a Buffer object. Note that Buffer.Size returns an exact byte count, whereas the old return value was always an even number of bytes as it was contained within a UTF-16 string.

Improved validation and error messages for ProcessWait, ProcessWaitClose, NumGet, NumPut and DllCall Str args.
Fixed File.RawRead/RawWrite second parameter to be optional as noted in v2-changes.
Merged pull request #138 from Ragnar-F/AutoHotkey_L.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 8 guests