Main breaking changes:
- x is typestring -> istypestring(x) (e.g. isNumber(x), isXDigit(x), etc.)
- base.method() -> super.method()
- GuiCreate -> Gui.New, MenuCreate -> Menu.New, MenuBarCreate -> Menu.New
- Static variable initializers do not "auto-execute"
- Non-literal property names in object literals require %..% (e.g. {%nameVar%: valueVar}
- ObjRawGet, ObjRawSet -> Obj.GetOwnPropDesc, Obj.DefineProp (with different usage)
- Removed "On"/"Off"/"Toggle" - use 1/True/0/False/-1
(excludes functions which also accept other strings: Hotkey, Hotstring, Set*LockState, BlockInput)
- #HotIf can now use ThisHotkey, and cannot reference undeclared globals (consistent with hotkeys)
Details and other changes:
Added
f(p:=unset) parameter default, which allows functions to use
IsSet(p) to detect whether a parameter was omitted.
Changed the default script codepage to UTF-8.
Split
x is typestring into
functions such as isNumber(), with the
is operator's only remaining use being
x is classobj (type checking).
Replaced
base.method() with new reserved keyword
super.
- Always acts like a keyword, not a variable-keyword hybrid.
- Attempting to use it where it wouldn't work (outside a class) is detected as a load time error.
- Should be no confusion between super.method() and obj.base.
Implemented the
Gui,
Menu and
MenuBar classes. Use
Gui.New(),
Menu.New() and
MenuBar.New() in place of GuiCreate(), MenuCreate() and MenuBarCreate(), which have been removed.
Changed Gui to allow subclass instances to be their own
event sinks.
- Subclass must call super.__new(opt, text, this) from __new.
- The circular reference is not counted, so will not cause leaks.
- The redundant Gui parameter is omitted for main Gui events.
Changed how
(local) static variables are initialized.
- Each initializer is executed only if/when it is reached during execution.
- Since the function has been called, parameters, A_ThisFunc and closures are available.
- If execution reaches it again, it is skipped.
- Multiple declarations are allowed, and each one may execute once.
- For auto-execution, use the auto-execute section (which is no longer interrupted by hotkeys, and need not be terminated with a return).
Changed
object literals to be stricter and more consistent with
.prop.
- {a:b} -> {}.a := b
- {%v%:b} -> {}.%v% := b
- Any other kind of expression to the left of : is an error.
Extended
DefineProp and
GetOwnPropDesc for use with value properties.
Removed ObjRawGet and ObjRawSet.
Changed
Menu.Add(t) to not default to using
t as a function name (in other words, the second parameter is required when creating a new item).
Removed the use of SPI_SETFOREGROUNDLOCKTIMEOUT on startup.
- My recent testing on Windows 10 indicated it was ineffective, even when a separate process verifies the change occurred.
- User reports (and common sense) indicate that if it works, it allows the focus to be stolen by programs which aren't specifically designed to do so.
- It can be replicated in script easily:
Code: Select all
DllCall("SystemParametersInfo", "int", 0x2001, "int", 0, "ptr", 0, "int", 2)
Changed
WinActivate to send
{Alt up} on its first failed attempt.
Testing on Windows 10.0.19555 indicates this improves the reliability of all subsequent attempts, thereby preventing buttons from flashing more than once per script process.
Changed
OwnProps() to skip dynamic properties which lack a getter in
this or which require parameters, but only if a value was requested (i.e. they are not skipped when using a for-loop with one variable).
Removed the rarely-used capability to use dynamic output variables with For and Catch, to simplify the implementation.
Removed On/Off/Toggle from most variables/functions.
- #UseHook and #MaxThreadsBuffer allow 1, 0, True and False. (Unlike the others, they do not actually support expressions.)
- ListLines allows blank or boolean.
- ControlSetChecked, ControlSetEnabled, Pause, Suspend, WinSetAlwaysOnTop, and WinSetEnabled allow 1, 0 and -1.
- A_DetectHiddenWindows, A_DetectHiddenText, and A_StoreCapsLockMode use boolean (as do the corresponding functions).
Simplified
Pause().
- If the first parameter is omitted or blank, it pauses the current thread, for ListVars/Pause and similar.
- Any other value operates on the underlying thread. In particular, this allows #p::Pause(-1) to toggle pause (again).
Enabled
#Warn UseUnset by default - to be converted to a continuable error at some point.
Changed top-level classes to be constants, prohibiting class overwrite (and removed
#Warn ClassOverwrite).
Changed
uninitialized.x() to always be an error.
This usually produced an error dialog with 'This value of type "String"' (unless String has x()), which is a bit misleading/not very informative. Previously there was no "unset" warning even with #Warn.
Changed continuable error dialogs to discourage continuing.
Changed control flow statements to throw if a parameter unexpectedly resolves to an object. For example:
Loop {}
Changed FileCopy/FileMove to throw if there are no wildcards in the source path and no file is found.
Changed InStr to throw if Needle is zero-length.
Added validation to Gui.Move() and GuiControl.Move().
Merged pull requests #181 and #182 from Helgef:
- #HotIf now implicitly creates an assume-local function with one parameter: ThisHotkey. For now, it cannot reference global variables without a global declaration (consistent with hotkeys).
- Bug fixes relating to #HotIf.
Fixed
Menu.Add(t, obj, opt) not updating callback if item exists.
Fixed
Menu.Add(t) to throw "parameter #2 must not be blank" rather than "invalid parameter #2".
Fixed empty
Clipboard variable being created on startup.
Fixed WinSetEnabled detecting failure incorrectly.
Merged v1.1.33.00 (release delayed due to issues with the certificate I use to sign the installer).