AutoHotkey v2 alpha (UPDATES)

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

Re: AutoHotkey v2 alpha (UPDATES)

28 Mar 2015, 21:19

AutoHotkey v2 (downloads and information)

v2.0-a065-2c0a4ca

Changed "NaN" string back to "".
Added validation for numeric (formerly "can be an expression") command parameters.
Fixed DllCall to throw an exception if the function isn't found.

Merged v1.1.21. Compared to previous v2 alphas, the changes are:
  • Remove (different from v1) was renamed to Delete.
  • Length now returns 0 if only negative keys exist.
  • MaxIndex and MinIndex have been restored.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

02 May 2015, 20:14

v2.0-a066-95ee96a

Merged v1.1.22.00.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha

08 Jun 2015, 03:14

v2.0-a067-0d76182

Changed objects to treat pure decimal numeric string keys as integers.
Changed Hotkey command to never treat On/Off/Toggle/AltTab as a label.

Fixed var return optimization (crashing etc., only seemed to affect AutoHotkeySC.bin).

Merged v1.1.22.02.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

13 Jun 2015, 01:05

v2.0-a068-5b3205b

Fixed use of commas between parentheses with If (expression).
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

24 Oct 2015, 21:58

v2.0-a069-d665496

Fixed x[y*] := z.
Fixed instance var sub-initializers (x.y := z in class body, where x was previously declared).
Merged v1.1.22.07.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

09 Nov 2015, 17:05

v2.0-a070-fb9b9b8

Fixed returning of a built-in var without other operators, such as return A_AhkVersion.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

25 Dec 2015, 20:35

v2.0-a071-35ed6e1

Fixed Object._NewEnum() creating two enumerators and leaking one (thanks HotKeyIt).
Fixed vars to trigger __Delete after clearing their object, not before.
Fixed local vars to not retain values when __Delete causes recursion (thanks HotKeyIt).

v2.0-a072-fefb925

Merged v1.1.22.09.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

05 Feb 2016, 19:06

v2.0-a073-f02fd20

Fixed appending small values to numeric vars.
Merged v1.1.23.01.
Made A_CoordMode.., A_..Delay/Duration.., A_Send.. and A_StoreCapslockMode vars writable.
Added RegDeleteKey, RootKey\SubKey.
Changed RegDelete to delete the key's default value when ValueName is omitted/empty, for consistency with RegWrite, RegRead and A_LoopRegName.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

11 Mar 2016, 22:04

v2.0-a074-9bc9379

Merged v1.1.23.03.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

03 Jun 2016, 23:04

v2.0-a075-02fab78

Changed StrGet to truncate the string at the first binary zero (null terminator), as in v1. Specifying a negative Length now causes it to extract exactly Abs(Length) characters (as previous builds did for positive values), utilizing v2's support for binary zero in strings.

Fixed omitting of output vars with function syntax. MouseGetPos(, y) now works. MouseGetPos("", y) is now invalid.
Fixed detection of simple expressions erroneously used as output vars (to show an error message instead of crashing).
Optimized WinGet.
Some other code maintenance.

Merged v1.1.24.00.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

15 Oct 2016, 02:02

v2.0-a076-aace005

Input now returns EndKey:a-z in lower-case if that's what the keyboard layout returns.

Added the capability to set the default dialog title (for MsgBox, InputBox, FileSelect, DirSelect and Gui) by assigning to A_ScriptName.

The following names are no longer allowed as variable, function, class or window group names: If, Else, Loop, LoopFile, LoopRead, LoopReg, LoopParse, For, While, Until, Break, Continue, Goto, Gosub, Return, Try, Catch, Finally and Throw. The primary purpose of this is to detect errors such as if (ex) break.

Experimental: Loop, LoopFiles, LoopRead, LoopReg and LoopParse now support a function-like syntax, where the entire parameter list is enclosed in parentheses and all parameters are expressions. OTB is also supported. For example:

Code: [Select all] [Download] GeSHi © Codebox Plus

LoopRead(A_ScriptFullPath) {
MsgBox("The first line of this script is: " A_LoopReadLine)
break
}
Currently there must not be a space between "Loop" and the sub-command name, due to ambiguity. (Files, Read, Reg and Parse are not reserved names.)

Return and Until no longer require a space or comma after the function name if the expression starts with an open-parenthesis. This brings them in line with If and While.

Bug fixes:
Corrected FileOpen exception message.
Fixed Sort functions with 3 parameters.
Fixed Loop,Files/Parse/Read/Reg .. Until.
Fixed ObjBindMethod, ObjPop and ObjPush to have an OutputVar when called as commands.

Other:
Merged v1.1.24.02.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

26 Nov 2016, 01:33

v2.0-a077-c2bb552

Fixed dynamic calling of built-in command-functions with surplus parameters.
Fixed (via merge) Exit within an OnExit function to act like return false, not return true.
Merged v1.1.24.03.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

19 Mar 2017, 04:24

v2.0-a078-e25d96b

Fixed expression lines starting with "".prop, as in "".base.x := y.

Merged v1.1.25.01.

Changed syntax of MsgBox, InputBox and TrayTip.

Code: [Select all] [Download] GeSHi © Codebox Plus

MsgBox [, Text, Title, Options, OutputVar]
Result := MsgBox([Text, Title, Options, OutputVar])

InputBox, OutputVar [, Text, Title, Options, Default]
Result := InputBox([Text, Title, Options, Default])

TrayTip [, Text, Title, Options]
TrayTip([Text, Title, Options])

See the documentation or v2-changes for details.

Note:
  • MsgBox now treats commas the same as every other command. No more "smart" comma handling.
  • A_MsgBoxResult was removed.
See MsgBox, InputBox, TrayTip - AutoHotkey v2 Development for background info.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

10 Jun 2017, 21:57

v2.0-a079-be5df98

The Big Changes

Removed legacy command syntax and %expression% substitution in strings.

That is, a "command" is now just a function or method call which sits at the start of the line, lacks parentheses and discards its return value. Aside from parentheses, commands and functions now share the same syntax. In general, functions with a single return value do not use an output variable, so usually require parentheses to be useful. See v2-changes for details.

Related changes:
  • Added goto(expr) and gosub(expr) statements (not functions), since goto and gosub without parentheses do not support variables.
  • Removed load-time validation code for command parameters, which no longer applied due to expressions.
  • Removed LoopFiles/LoopParse/LoopRead/LoopReg (now require a space).
  • Removed MsgBox's redundant OutputVar.
  • Removed Deref().
  • Changed `, to have no special meaning (previously it acted as though enclosed in parentheses; i.e. did not delimit command parameters). This ensures `, has the same effect regardless of whether parentheses are used.
  • Removed the , and % continuation section options and the escaping of , by default, since there's no longer any reason to escape it.
  • Added InputEnd(), since Input no longer has an OutputVar to omit. InputEnd sets ErrorLevel to "End".
  • Added RandomSeed(), since Random no longer has an OutputVar to omit.
Implemented the new GUI API. https://autohotkey.com/boards/viewtopic.php?f=37&t=2998


Other Syntax Changes

Changed /* to allow */ at the end of the line. See v2-changes for comments.

Enabled the `s escape anywhere `t is allowed. It was previously only allowed by #IfWin and (Join.

Improved load-time syntax validation of expressions.

Removed *deref operator.

Removed Object.Length (not Object.Length()) because it causes surprising behaviour with associative arrays (so does "base", but that will be addressed later). Object.Length was added in v2.0-a049 (c1196f1e).

Fixed sub-expressions like (A_WorkingDir := y) producing an unusable variable reference in some contexts.


Library Changes

Replaced ClipboardAll variable with ClipboardAll() function.

  • Replaced "binary clip" var attribute with a built-in object type.
  • Removed special clipboard modes of FileRead/FileAppend.
  • Added general "RAW" binary mode for FileRead/FileAppend.
  • Changed ClipboardAll to always use 32-bit data sizes.
Split Control, ControlGet, Drive and DriveGet sub-commands into separate functions (with some renaming).

Changed ControlChoose(N) to allow N = 0 (deselect all).

Optimized ControlGetCurrentCol().

Changed ControlGetFocus to set ErrorLevel:=0 when there's no focus.

Fixed ControlGetTab() to return 0 when no tab is selected.

Removed ControlTabLeft/ControlTabRight and added ControlSetTab.

  • TabLeft/TabRight were equivalent to ControlSend with {Left/Right} after SetKeyDelay -1, 0.
  • TabLeft/TabRight did not work correctly with TCS_BUTTONS.
Changed parameter order of ControlMove, ControlSend, ControlSetText, WinSetTitle and WinMove to be consistent with other functions.

Fixed DirExist(pattern) to skip over files matching the pattern.

Changed FileExist and DirExist to ignore . and .. in dir\*.* so they behave as most users would expect (for detection of empty vs. non-empty directories).

Fixed FormatTime to return strings for WDay/YDay (not pure numbers) and throw an exception if Format exceeds 2000 chars (vs. silently failing).

Changed MsgBox and InputBox to allow explicitly empty title.

Changed SoundSet and SoundGet to throw an exception for "Invalid Control Type or Component Type" (invalid parameter).


File I/O

Changed FileRead and FileAppend to be more consistent.

Code: [Select all] [Download] GeSHi © Codebox Plus

Data := FileRead([Filename, Options])
FileAppend(Data [, Filename, Options])
; Options: "`n m1024 Encoding|RAW"
; Default to no end-of-line translation.

Changed File.ReadLine() to always recognize `r, `n and `r`n as line endings. EOL options now only affect translation of characters passed from or to the script.

Reverted FileOpen EOL options/default to how they were in v1 (with the exception of ReadLine()), for consistency with FileRead/FileAppend.

Changed File.RawRead/RawWrite to support binary strings and address_var.
  • If a variable containing a pure number is passed, the number is used as an address, consistent with NumPut/NumGet.
  • RawWrite can accept a binary string directly, such as one returned by ClipboardAll().Data.
  • RawRead updates the variable's length to include all of the read data (rounded up to the next multiple of sizeof(TCHAR)).
Bytes (param #2) is optional when passing a binary string/variable:
  • For RawWrite, it defaults to the binary string length.
  • For RawRead, it defaults to the variable's capacity.
Changed A_FileEncoding to return "CP0" instead of "", because otherwise, enc := A_FileEncoding ... FileAppend(s, f, enc) may not have the intended effect.


Registry

Merged A_LoopRegSubKey into A_LoopRegKey (and removed the former).

Changed parameters of RegWrite/RegDelete/RegDeleteKey.
  • Put Value first for RegWrite, like IniWrite.
  • If the current Loop Reg item is a subkey, let the Reg functions operate on it by default (omit KeyName but specify ValueName).
  • If the current Loop Reg item is a value, let the Reg functions operate on A_LoopRegKey by default.
  • Let RegWrite specify a new ValueType when writing to the current Loop Reg value.
  • Change RegDelete without params to never delete keys; only values.
  • Let RegDeleteKey's param be omitted to delete the current key.

Documentation

New documentation has been written for most of the changes, but not all examples have been updated. The syntax shown for each function (in the yellow blocks) has been updated. The new "command" syntax is not fully documented, but neither was the old syntax.
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

11 Jun 2017, 17:09

v2.0-a080-d1c5ddf

Merged v1.1.26.00.

Fixed FileDelete/SetAttrib/SetTime to use v2 policy for invalid params (throw).
Changed FileSetAttrib without +/-/^ to overwrite attributes.
Changed type names returned by Type(obj).
Improved accuracy of ListLines with the new syntax.
Restored ListLines "On" as the default.
  • ListLines has better debugging value if it can be used without the author having first anticipated that it will be needed.
  • Performance impact is negligible or sometimes not measurable.
Revised SendMessage and PostMessage with variables/strings.
  • All strings are passed by address, whereas previously only quoted strings in command mode were passed by address, and all other values were assumed to be numbers.
  • Variable length is updated if a variable is passed by reference.
  • Variable length is not updated if a variable's address is passed, because that's outside what the language is supposed to allow (and difficult/impossible to achieve with pure expressions).
lexikos
Posts: 5410
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: AutoHotkey v2 alpha (UPDATES)

15 Jul 2017, 21:08

v2.0-a081-cad307c

Fixed Exception(,-n) to only count user-defined functions/subs as in v1.
Fixed not operator being flagged as an error.
Fixed e+(1) being misinterpreted as a function call.
Added detection of invalid literals such as (.) and (.foo).
Fixed DirExist() without wildcards to return blank if not a directory.
Merged v1.1.26.01.

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 4 guests