Wish List 2.0

Propose new features and changes
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Wish List 2.0

08 Sep 2017, 01:42

= = = = = MY 2ND AUTOHOTKEY V1/V2 WISH LIST = = = = =

[updated: 2019-08-22]
[note: this list is regularly tweaked, so I would recommend taking a copy and using WinMerge, or equivalent, to check for changes]



any names could be changed as desired

- AHK v1: operator: is [or a function version would be fine] [if (var is "type")]
- AHK v1/v2: operators: contains/in [or function versions would be fine]
- AHK v1/v2: A_ variables: A_AhkVersionMain/A_OSVersionMain (or other names) [e.g. 1.1/6.1] [or alternatively an '/inc' command-line switch to specify files for inclusion] [maybe A_AhkVersionPart1/Part2 or A_AhkVersion1/2/3/4 or equivalent for use with #Include]
- AHK v1/v2: operator: mod [to maintain formulas intact]
- AHK v1: #If WinActive() (optimised)
- AHK v1: Loop (expression) [parentheses to hold an expression]
- AHK v1/v2: LoopFiles/LoopParse/LoopParseCSV/LoopRead/LoopReg [no spaces cf. 'Loop Files'] [perhaps make LoopParse Delimiters parameter like StrSplit]
- AHK v1/v2: A_ variables: A_AhkDir/A_AhkName/A_AhkNameNoExt, A_ScriptNameNoExt [for #Include / dialog titles]

[two-way compatible Loop]
why was LoopParse (no space) removed? - Page 4 - AutoHotkey Community

[note: a small number of AHK v2 features (Loop/in/contains) could be backported to AHK v1 with the explicit warning that their behaviour might change in future, 'bridging features']

- AHK v2: fix (restore) comparison of variables containing numeric-looking strings
Bug: StrSplit - AutoHotkey Community
- AHK v1/v2: 'global A_XXX' to not cause a crash, and a VarIsInit/IsInit function [to facilitate backporting A_ variables] [note: VarIsInit to report 2/A/B/something else for built-in variables]
- AHK v2: ControlXXX functions: always allow the Control parameter to be omitted [more flexible/convenient, consistency]
- AHK v2: // (floor divide), /// (integer divide) [// is already called 'floor divide' in AHK, and // is floor divide in Python]
- AHK v1/v2: A_DlgTitle for GUIs (not A_ScriptName) (or another name)
- AHK v1/v2: Pow [to maintain formulas intact]
- AHK v1/v2: StrReplace: add StartPos/CaseSen parameters [StartPos consistent with RegExReplace]

- AHK v1/v2: (switch statement)
- AHK v1/v2: (long-path support in Loop Files)
- AHK v1/v2: ahk_dhw/ahk_mode or equivalent [could combine both as ahk_mode]
- AHK v1/v2: IsPassed or A_ThisFuncParams.HasKey() or equivalent
- AHK v2: A_BIF.XXX() [redefine but access built-in functions] [perhaps for v1 as well]

- AHK v2: Sort: handle arrays, stable sort A_ variable (and option), null sort option (e.g. null sort + R option = reverse with no sort)
- AHK v1/v2: assign text (single line) (AHK v1 style) var `= value [support `s]
- AHK v1/v2: assign text (multi-line) two-way compatible AHK v1-style continuation sections [or Deref with %A_Pct% for a literal %]
- AHK v1/v2: assign text (multi-line) two-way compatible verbatim continuation sections [handle "]

NEW FUNCTIONS [AHK V1/V2, for the convenient sharing of scripts on the forum]
- StrJoin [print keys/values] [also: String/ObjToString]
- StrRept/StrCount

- <> operator (as it was in AHK v1) [based on A_StringCaseSense, as are: < <= > >=]
- NumPut (same parameter order)
- VarSetCapacity [or equivalents: e.g. both StrSetCapacity (chars) and StrSetSize (bytes)]

- File object: Handle property
- #SuspendExempt, and Suspend() at start of a subroutine
- read-only A_AllowMainWindow/A_InitialWorkingDir
- writable 'A_' variables, or an Assign function (needed for A_AllowMainWindow/A_IconHidden/A_IconTip)
- FileInstall()
- perhaps: support for `s in hotstrings [versus: trailing 'space backtick']

- perhaps:
- var := var%obj.key% [temporary variables are a workaround]
- obj.%property%
- obj.%method%() [switch statements are a workaround]
- obj.Has() method
- obj.Length and obj.Count properties


- perhaps add options:
- checkbox: add 'open with' support for ahks
- checkbox: add 'AutoHotkey Script' to the 'New' menu
- (possibly add checkboxes for other changes: e.g. Run Script/Edit Script for ahk file context menu)




- VarSetCapacity [or equivalents: e.g. both StrSetCapacity (chars) and StrSetSize (bytes)], other possibilities:
- StrGetCapacity/>StrSetCapacity<, [StrLen]/>StrSetLen< [chars]
- VarGetCapacity/[VarSetCapacity], >SizeOf</VarSetSize [bytes]
- [an A_ variable so that VarSetCapacity can maintain data]

- Base64Get/Base64Put, HexGet/HexPut
- FloorMod [if divisor is positive, result is positive/zero][like Python's % operator]
- Range [similar to Excel VBA for loop: start end step]
- possibly in some form: BaseToDec/DecToBase
- possibly in some form: SwapBytes [easier than bitshifting, e.g. (A)RGB to/from BGR(A)]

- AHK v1/v2: OnHotkey [specify a function to call each time any hotkey is triggered, e.g. log hotkey data] [perhaps OnHotstring also]












- [ADD PARAM] Ceil(Num, DP:=0) [DP]
- [ADD PARAM] Floor(Num, DP:=0) [DP]
- [ADD PARAM] Log(Num, Base:=10) [Base]
- [NEW] Between(Num, Lim1, Lim2) [x <= y <= z, chained operators, would be fiddly and add ambiguity] [already in AutoHotkey_H]
- [NEW] NoOp(Params*) [e.g. useful for if/else ladders]
- [NEW] Pow(Num, Power) [for use with libraries that are maintained across multiple programming languages cf. mod operator, and useful for changing an object's default value]
- [NEW] Sign(Num) [using Sign(), instead of a calculation, makes the code's intention clearer]
- [NEW] StrCount(Haystack, Needle, CaseSen:=0, StartPos:=1) [or omit the StartPos parameter for now][note: StrReplace to do StrCount may not be optimised, and is confusing for newbies]
- [NEW] StrJoin(Sep, Params*) [perhaps accept a linear array to have an alternating separator]
- [NEW] StrRept(Text, Num) [note: Excel has 'Rept', and 'StrRepeat' is too long]
- [NEW] VarIsInit(Var) or IsInit() [see lower down]

- [NEW][FURTHER] ATan2(NumY, NumX)
- [NEW][FURTHER] IsNum(Num) [if looks numeric] [a 2nd Options parameter could be added, such that only variables of Float/Integer type would qualify]
- [NEW][FURTHER] Num(Num, Default:="") [to number, cf. Integer/Float][if doesn't look numeric, error, unless default value is specified]

- [NEW][FURTHER] Base64Get/Base64Put [similar to StrGet/StrPut]
- [NEW][FURTHER] FloorMod(Dividend, Divisor) [when Divisor is positive, return value is positive(/zero)]
- [NEW][FURTHER] HexGet/HexPut [similar to StrGet/StrPut]

- [NEW][FURTHER] Product(Params*) [if people want this function, I'm neutral]
- [NEW][FURTHER] Sum(Params*) [if people want this function, I'm neutral]


- [ADD PARAMS] StrReplace(Haystack, SearchText, ReplaceText, OutputVarCount, Limit:=-1, StartPos:=1, CaseSen:=0) [StartPos, CaseSen]
- [MODIFY] GuiFromHwnd [take over a GUI window created via DllCall][e.g. create a window and specify the class name and no icon]
- [MODIFY] PixelGetColor/PixelSearch [add a BGR option to AHK v2][note: aids automatic conversion]
- [MODIFY] Sort [see SORT (IMPROVED), e.g. handle arrays, stable sort, reverse with no sort]
- [NEW] BaseToDec/DecToBase (Num, Base) [or equivalent][a 3rd parameter, Chars(/Symbols), could allow you to specify which characters correspond to 0 to 'base-1': a linear array allowing multiple-character strings]
- [NEW] OnEdit (or a writable variable A_EditFunc): specify the name of a function to use instead of the Edit command (for when you don't have access to the registry, or when running scripts from an external drive) [a less-good alternative: in AHK v1/v2, if a custom function called 'Edit' exists, it is called whenever Edit is used]
- [NEW] Range [for a traditional for loop, and for doing mathematics (populating an array)][for i = a to b (step c)][based on Excel VBA for loop]
- [NEW] SwapBytes [or equivalent][see 'SwapBytesInt' lower down]


- In general, options: *specify hFont*, timeout, window position/size.

- [MODIFY] InputBox/ToolTip font [an HFONT:hFont option would be sufficient IMO, perhaps also name/*size*/weight options]
- [MODIFY] Progress/SplashImage kept [very convenient for debugging, worth keeping in some form in AHK v2][ultimately, having them as 'semi-official' functions makes no sense: newbie-unfriendly/difficult to share code on the forum]
- [MODIFY] ToolTip/Progress/SplashImage timeout [option to make the window timeout] [and the option to make it persist until the timeout is complete, i.e. a sleep]
- [MODIFY] ToolTip/Progress/SplashImage colours [consistently referred to as '0xABCDEF', not 'ABCDEF']

- [MODIFY] MsgBox via InputBox:
- (InputBox has size/position options which MsgBox doesn't)
- HFONT:hFont option
- NoEdit option for no Edit control
- [note: MsgBox font size: if you change the system MsgBox font, this adversely affects multiple programs, e.g. Firefox, wxMaxima, installers, e.g. distorting status bars, and expanding windows beyond the size of the screen]
- button labels: perhaps the option to specify the button count, the button labels and the default button number


- [MODIFY] ControlGetLine [if Line omitted/blank, return text of current line]
- [MODIFY] ControlXXX [AHK v2: a blank Control parameter equivalent to omitting parameter (i.e. operate on control/window specified in WinTitle parameter)]
- [MODIFY] SubStr [a blank Length parameter equivalent to omitting parameter]
- [MODIFY][FURTHER] RegWrite [perhaps: make it possible to omit the type, i.e. assume the existing type]


- [MODIFY] VarSetCapacity [maintain existing data by default, with an Options parameter or A_ variable to allow it to be discarded]
- [NEW] StrSetCapacity(Var, CapacityChars, FillChar)
- [NEW] StrSetSize(Var, Size, FillByte) [create string intended to store binary data]
- [NEW] VarExist(VarNameAsStr) [check if a variable exists]
- [NEW] VarGetName(Var) [pass a variable, retrieve its name, useful for debugging/displaying]
- [NEW] VarIsInit(Var) or IsInit() [check if a variable is initialised] [report 2/A/B/something else for built-in variables]
- [NEW] VarSwap(Var1, Var2) or Swap() [and perhaps: ObjSwapKeys(/ObjSwapValues/ObjSwap)]
- [NEW][FURTHER] VarSet/Assign [OldValue := Assign(Var, NewValue)]

- see also: Base64Get/Base64Put/HexGet/HexPut, Between/FloorMod/Pow/Sign, IsNum(/Num), NoOp, ObjSetDefaultValue, Range, StrCount/StrJoin/StrRept

- (StrGetCapacity/)*StrSetCapacity*, [StrLen]/StrSetLen [unit: chars]
- (VarGetCapacity/)[VarSetCapacity], SizeOf(/VarSetSize) [unit: bytes]
- *StrSetSize* [unit: bytes]


- [ADD PARAM] DateAdd(DateTime, Time, TimeUnits, Format:="yyyyMMddHHmmss") [Format]
- [ADD PARAM] FileGetShortcut(LinkFile, OutTarget, OutDir, OutArgs, OutDescription, OutIcon, OutIconNum, OutRunState, OutShortcutKey) [OutShortcutKey][cf. FileCreateShortcut]
- [MODIFY] DateAdd [perhaps allow add months (e.g. + 3 months: 31 Jan -> '31 Apr' -> 30 Apr)]
- [MODIFY] Format [perhaps support an associative array: Format("{key1} {key2}", oArray)]
- [MODIFY] FormatTime [if possible, fix 'date and time elements together, they must not be intermixed']
- [MODIFY] Send ['{Sleep n}' option]
- [NEW] BinCopy(/MemCopy/NumCopy) (Dest, Source, Size) [cf. RtlMoveMemory/memmove]
- [NEW] BinCompare (Addr1, Addr2, Size, ByRef DiffOffset) [cf. RtlCompareMemory/memcmp][perhaps DiffOffset for StrCompare also]
- [NEW] MakeUInt64(Low, High) [or possibly MakeType(Type, Low, High), or MakeType(Low, High, Type), or MakeNum, or MakeUShort/MakeUInt]
- [NEW] MCeil/MFloor/MRound (Num, Mult) [round to nearest multiple]
- [NEW] ObjToString(Object)
- [NEW] ProcessGetPriority(PIDOrName, Opt:="") [return a word, perhaps specify Opt:="n" for a number]
- [NEW] RegCreateKey(KeyName) [create a key without creating a value cf. RegWrite]
- [NEW] WinGetOwner/WinGetParent ([WinTitle, WinText, ExcludeTitle, ExcludeText])
- [NEW] WinSetOwner/WinSetParent (hWnd(Owner/Parent) [, WinTitle, WinText, ExcludeTitle, ExcludeText]) [a tricky decision, it may be better to mimic the order of SetParent/SetWindowLong, but that could mean losing the 'WWEE' parameters]
- [MODIFY][FURTHER] RegExMatch/RegExReplace ['ANSI mode': better support for 1-byte and 2-byte characters: e.g. binary/ANSI/UTF-8/UTF-16 searches][File object: ReadHex/HexRead might also be useful]
- [MODIFY][FURTHER] Reload [perhaps an option to maintain the command-line parameters when reloading][and to not show a MsgBox][options could be specified when the script receives a message from another script, via the lParam value]
- [NEW][FURTHER] ControlGetChoiceString [ControlGetChoice split to ControlGetChoice (return index) and ControlGetChoiceString (return string), consistent with ControlChoose and ControlChooseString]
- [NEW][FURTHER] FileEmpty(Path) (or FileSetText/FileWrite), FileGetEncoding(Path)
- [NEW][FURTHER] NumCompare [to match StrCompare] [there could be a version compare option or separate VersionCompare/VerCompare function]
- [NEW][FURTHER] PathGetPart(Path, Part) [or FileGetPart]
- [NEW][FURTHER] ProcessGetCommandLine(PIDOrName)
- [NEW][FURTHER] ProcessIsAdmin(PIDOrName) (or ProcessIsElevated)
- [NEW][FURTHER] ProcessIs64Bit(PIDOrName)
- [NEW][FURTHER] RegExMatchAll [at least a custom function in the documentation]
- [RENAME] Integer -> Int [or, if don't rename 'Integer', perhaps introduce Trunc, with a decimal places parameter like Round]
- [RENAME] String -> Str




- [FURTHER] A_OParen/A_CParen/A_Pct [ ( ) % ] [or: A_LParen/A_RParen]
- A_AhkDir/A_AhkName/A_AhkNameNoExt [AutoHotkey_H already has A_AhkDir]
- A_ChrSize/A_WA [2 or 1, W or A]
- A_Comma/A_DQ/A_SQ [ , " ' ]
- A_LoopFileAttribValue
- A_LoopFileNameNoExt
- A_LoopFileTimeAccessedUTC/A_LoopFileTimeCreatedUTC/A_LoopFileTimeModifiedUTC [and possibly a UTC option for FileGetTime]
- A_Recent [Recent folder] [or A_RecentDir]
- A_ScriptNameNoExt
- A_ScriptPID


- [KEY] A_DlgTitle(/A_GuiTitle/A_DefaultTitle) [keep A_ScriptName read-only/dependable][e.g. A_DlgTitle := (A_ScriptNameNoExt = "") ? A_AhkNameNoExt : A_ScriptNameNoExt]
- A_AhkVersionMain(/A_AhkMainVersion) [e.g. 1.0, 1.1, 2.0]
- A_IconFileXXX: tray icons: specify hIcons for the 4 icons via a variable/function: Pause on/off, Suspend on/off (e.g. A_IconFile (already exists), A_IconFileP, A_IconFileS, A_IconFilePS)
- A_InputBoxResult [easier to replace 'if ErrorLevel', avoid ugly use of a ByRef InputBox parameter]
- A_MSecLast [the milliseconds at the time you last retrieved A_Now/A_NowUTC][another idea would be: update date variables, lock them so they can't change, unlock them]
- A_MsgBoxResult [easier to replace 'IfMsgBox']
- A_OSVersionMain(/A_OSMainVersion) [e.g. 5.1/5.2 (XP), 6.0 (Vista), 6.1 (Windows 7)]
- A_SortMode(/A_SortStable) [stable sort for Sort]

- InputBox/ToolTip: an A_ variable/object to set the InputBox/ToolTip font size/properties e.g. A_InputBoxFontSize, A_ToolTipFontSize [or A_InputBoxHFont / A_ToolTipHFont]
- Format: perhaps a way to change '{}' to other characters temporarily e.g. A_FormatChars
- Thread/Critical: an option to cache/discard hotkeys pressed while any subroutine is running. Perhaps an 'A_' variable. E.g. A_HotkeyCache / A_CacheHotkeys or something else.



ideas, any of these can be changed as desired


- allow lines of the form 'global A_XXX'

Code: Select all

global A_XXX ;this would not cause a crash
if !A_XXX
	var := "A_XXX", %var% := value

vChar := A_BIF.SubStr(vText, 1, 1)


- OnHotkey/OnReturn (perhaps: OnHotstring also)
- specify a function to execute each time a hotkey is triggered, or before a return is executed
- e.g. for usage data: the function called would make use of 'A_' variables to record hotkey/hotstring data (an A_ThisHotkeyHwnd variable would aid this)
- ('OnHotkey' would be preferable, I mentioned 'OnReturn' because, as a workaround, I've used a 'RetX' function (which uses Exit) where 'return' would be)


- Since the letters HV and CERSX don't overlap, ahk_mode could be used to perform both roles.
- E.g. use A_DetectHiddenWindows unless H and/or V is seen. E.g. use A_TitleMatchMode unless one of S/C/X/E/R is seen.
- [or perhaps Q (equals) instead of X (exact)][see also: StrExact v. StrEquals]

- e.g. if WinActive("Untitled ahk_class Notepad ahk_dhw H ahk_mode S")
- or if WinActive("Untitled ahk_class Notepad ahk_mode HS")
- this would search for a hidden window, with a title that starts with 'Untitled'

- (V/VH/H): visible/either/hidden
- (S/C/X/E/R): starts/contains/exact/ends/RegEx [or Q (equals)]
- (perhaps also a case sensitive/insensitive option)
- note: this is one of the few things in AutoHotkey that is always case-sensitive and thus causes confusion (perhaps, or perhaps not, case-insensitive should be the default)
- perhaps: ahk_xtitle, ahk_xtext (there is currently no 'ahk_title' or 'ahk_text')
- and: ahk_xclass, ahk_xexe, ahk_xgroup, ahk_xid, ahk_xpid
WinTitle & Last Found Window | AutoHotkey
- in AHK v2, an integer signifies an hWnd (if the parameter type is integer), perhaps instead it should signify an hWnd if the parameter looks numeric (ahk_title could be used as a prefix to force interpreting a number as a string)

- uses:
- useful for #If
- useful to avoid the repeated use of A_DetectHiddenWindows/DetectHiddenWindows and A_TitleMatchMode/SetTitleMatchMode
- useful since many window (and control) classes now have patterns requiring RegEx
- note: an extra reason for ahk_dhw and ahk_mode:
DetectHiddenWindows bug? - AutoHotkey Community

- 'ahk_mode R' could be added for Control/WinTitle parameters, for pattern-based but inconsistent class names (or otherwise something like: ControlGetHwndRegEx/ControlGetClassNNRegEx).

(and custom class direct to object) (low priority)

- something like this that can handle a complete function cf. fat arrow functions:

Code: Select all

oFunc := NewFunc(arg1, arg2, arg3)
	return arg1 arg2 arg3
- the same may be potentially useful for classes oClass := class ...
- otherwise you can get clashes with existing functions/classes for simple temporary code
- this would be very useful for comparison functions, for use with the Sort function


- 'alias functions' (or any existent name that is common within the programming community)
- when defining functions, to be able to refer to the same function but by using a different name, e.g. Func2() invokes Func1()
- there are some alternatives for dynamically referring to functions at present, but this would be simple to understand and newbie-friendly
- perhaps one of these possibilities (or something quite different, I am not particularly concerned about what the exact syntax would be):

Code: Select all

alias Func2 as Func1

;or this:
alias Func2 Func1

;or this:
	alias Func1

Code: Select all

vNum := 0b10001 ;17 = 16 + 1
vNum := 0b101010 ;42 = 32 + 8 + 2
- The Format function could have a 'b' option.


- if (a op1 b) [a finite set of redefinable binary operators e.g. 10, based on 2-parameter functions]
- perhaps: if (a starts b) [cf. in/contains, or a StrStarts function]
- perhaps: if (a ends b) [cf. in/contains, or a StrEnds function]
- if (a mod b) ['mod', since '%' would cause syntax confusion]
- // (always floor division)
- /// or idiv (integer division) (or some other symbol)
- <> (I would hope to keep this with the AHK v1 behaviour)
- also: contains/in/is for AHK v1/v2

- [add operators/functions to make it possible to preserve formulas from other programming languages intact without having to add/remove parentheses e.g. mod, //, ///, Pow function]

- ternary operator: an invalid ternary operator could raise an error in AHK v1


- GUI objects: oGui.B / oGui.R (or oGui.Pos.B / oGui.Pos.R) (bottom/right)
- GUI control objects: oGui.HwndParent
- [KEY] GUI menu objects: specify menu item IDs (e.g. for use with accelerator keys and compatibility with other programs)
- GUI objects: perhaps increased support for setting the colour of a control (add it for more control types)
- support for accelerator keys ('soft' hotkeys that can be overriden by other scripts, cf. 'hard' hotkeys)
- [KEY] Text/Value: the distinction between .Text and .Value is not clear, perhaps, in each case, .Value should be replaced with something more intuitive

- For reference:
GUI - Complete Command & Property Listing - AutoHotkey Community


- something like the following (the names aren't important):
- /inc switch: include files via the command line
Pre-execution Code - Page 2 - AutoHotkey Community
- #IncludeDirList: specify which folders to check, blank for none, e.g. #IncludeDirList %A_ScriptDir%\Lib|%A_MyDocuments%\Lib|%A_AhkDir%\Lib|%A_AhkDir%\Lib\ExtraFuncs [note: A_AhkDir is in AHK_H but not currently in AHK_L]
- or less good: #IncludeNoAuto (or #IncludePrevent/#IncludeBlock): prevent any files from being auto-included, all files would require an explicit include

- perhaps #IncludeAtEnd: insert code at the end of the script, rather than at the current point in the script
- perhaps #IncludeIfArgContains: include a file if the nth command-line parameter contains a certain string


- loop-and-delete: perhaps a way to delete keys during a for loop, perhaps a reverse loop [this would be a big change for a small/medium-sized problem so ...]
- or alternatively/additionally: a function that just removes empty or non-existent keys from linear arrays, or that removes keys with a particular value (conditional Delete/RemoveAt) [the main problem for me is not speed, but simple tasks in functions that become verbose and dominate/muddy the code]
- ObjRawGet/ObjRawSet to make it possible to create/read integer key names with String type in AHK v2 (AHK v1 already allowed this)
- a way to set the default value of an object (e.g. 0 instead of a blank string) e.g. ObjSetDefaultValue [or ObjDec/ObjInc]


- Re.:

- I mention some points re. ControlClick/MouseClick/Thread/VarSetCapacity here:
conversion logic, v1 = -> v1 := -> v2, two-way compatibility - Page 7 - AutoHotkey Community

- I mention some points re. ControlXXX functions here:
ControlXXX functions - AutoHotkey Community
- E.g. ControlGetChoice split to ControlGetChoice (return index) and ControlGetChoiceString (return string), consistent with ControlChoose and ControlChooseString.


- [KEY] IsPassed: perhaps for non-variadic functions, something similar to IsByRef: was the parameter passed/omitted [or a Null constant] [or A_ThisFuncParams.HasKey()]
- variadic and ByRef: perhaps variadic functions where all parameters are ByRef
- [KEY] if feasible, to make hotstrings more like hotkeys re. #If and the 'global variant': 'it will fire only if no other variant is eligible (this exception does not apply to hotstrings)'
- [KEY] continuation sections: allow longer strings (e.g. 4 times longer at least, perhaps even 10 times longer or more)
- make the default script name (e.g. for tray icons) 'NameNoExt' instead of 'NameNoExt.ahk' or 'NameNoExt.exe' [looks better, and may avoid script/exe differences]
- consistent function parameter order, consistency trumps other concerns:

Code: Select all

;oftentimes functions should be of the form 'XXX...(XXX, ...)':
ProcessSetPriority(PIDOrName, Priority) ;yes
ProcessSetPriority(Priority, PIDOrName) ;no
- Integer/String types should (almost) never matter in AutoHotkey:

Code: Select all


WinExist(1234) ;check for hWnd
WinExist("1234") ;check for hWnd (*not* title)
WinExist("ahk_title 1234") ;check for title

ControlChoose("1") ;choose 1st item (*not* item called '1')
ControlChooseString("1") ;choose item called '1'

;provide a way to store integers as string or numeric keys
oMap[1] := "number"
oMap["1"] := "string"
- source code: consistent capitalisations for function names, e.g. XXXCapsLockXXX, in the source code and when retrieving function names via Func: Func("StrLen").Name
- source code: tidy indentation (whitespace) in AHK source code files
whitespace summary: frequency count of leading/trailing spaces/tabs - AutoHotkey Community




- make 'Loop (Expression)' possible in AHK v1
- make 'LoopXXX' (no space) available in AHK v1/v2

Code: Select all

Loop Num ;[e.g. Loop 3]
Loop (Expression) ;[e.g. Loop (obj.Length())]
LoopFiles FilePattern [, Mode]
LoopParse String [, Delimiters, OmitChars]
LoopRead InputFile [, OutputFile]
LoopReg KeyName [, Mode]
- other notes on Loop:
- Loop-Parse: perhaps make the Delimiters parameter like the StrSplit parameter (the inconsistency is confusing)
- Loop-Files: perhaps allow arrays for the FilePattern/Mode parameters
- for loop: perhaps allow: for vKey, A_LoopField in oArray


An operator to assign in the AHK v1 style e.g.:

Code: Select all

vTarget `= "%vPathExe%" "%vPath%" ;great for command-line strings for use with Run
vText `= `shello`s ;support for `s in both AHK v1 and AHK v2
vText `= abc ' def " ghi ;allow both ' and " in a string without escaping e.g. for use with html or replacing code lines before/after text
vList `= abc,def,ghi ;handy oft-modified comma-separated lists without needing double quotes
obj.key `= my string
Note: AHK v1 `= lines could handle `s, even if it wasn't handled elsewhere.

- some other ideas: e.g. this post considers Format handling variable/object key names
AHK v2 and strings - AutoHotkey Community


- a two-way compatible way to assign verbatim multi-line text (perhaps a 'V' option)
- this works with expressions in AHK v1 and AHK v2, however, in AHK v1 double quotes need to be doubled up (" -> ""): (` Join`r`n
- (in AHK v1, all characters in an expression continuation section can be WYSIWYG except for double quotes)
- also, AHK v1 continuation sections could handle `" and `s, even if they aren't handled elsewhere
- (one use case: continuation sections consistent in both AHK v1/v2 are very useful for dynamic code that is going to be executed by another AHK process)

- a two-way compatible way to assign AHK v1-style text (perhaps an option letter)
- this would be handy, plus you could you make older scripts forwards compatible easily


- if (var contains list)
- if (var in list)
- if (var is type)

- On balance I think contains/in should treat a string as one item (not as a comma-separated list, or list of characters)

- [KEY] if they treat a string as one item, some handy syntax for handling a comma-separated/pipe-separated list string should be considered
- E.g. a custom one-liner can add a 'split' method for strings:
if var in/contains comma-separated list/array - Page 2 - AutoHotkey Community


- File object: Handle property
- #If WinActive() (optimised)
- #SuspendExempt and Suspend() at start of a subroutine
- A_AllowMainWindow/A_IconHidden/A_IconTip, A_InitialWorkingDir, (writable 'A_' variables)
- FileInstall()
- if (var is type) [and contains/in when functionality decided]

- perhaps:
- var := var%obj.key% [temporary variables are a workaround]
- obj.%property%
- obj.%method%() [switch statements are a workaround]
- obj.Has() method
- obj.Length and obj.Count properties


- AHK v2 functions to officially backport (ordered by priority):
- DateAdd/DateDiff, DirExist
- MsgBox function, Type, WinGetList

- Further:
- FormatTime function [to avoid unreliable 'A_' variable concatenation, handy in expressions]
- InputBox function
- ControlGetList ('ControlGetItems')/WinGetControls/WinGetControlsHwnd
- Random function [functions that can't easily be recreated via Winapi functions]
- ControlClick function [when it's finalised, the AHK v1 command is too fiddly]
- list of new AHK v2 functions for reference:
list of every command/function/variable from across all versions - AutoHotkey Community


- e.g. a SetAhkV2Mode function/A_V2Mode on/off variable (to make AHK v1 more like AHK v2) for the following 5 functions (RegExMatch is listed twice):
- InStr/SubStr/RegExMatch/RegExReplace: handle negative values for positions as in AHK v2 [workaround: I use JEE_InStr/JEE_SubStr which are two-way compatible]
- RegExMatch: in AHK v2: object mode is the default, and the line break handling has changed [workaround: I use JEE_RegExMatch which is two-way compatible]
- StrPut: AHK v2: return a byte count, AHK v1: return a character count [workaround: I use JEE_StrPut which is two-way compatible]

- further ideas: the mode could also set:
- A_OSVersion: always return a number, not a friendly name ('WIN_XXX') [not needed if A_OSVersionMain introduced]
- A_LoopRegKey: root key\subkey (AHK v2), root key (AHK v1)

- further ideas: a directive could do this:
- [KEY] double quotes: disallow "" but do allow `" [a workaround would be an A_DQ variable]
- Loop: use expression style parameters [not needed if LoopXXX and Loop (Count) are introduced]
- set all default settings equivalent to AHK v2
- ... something similar could exist for speed settings, e.g. #Speed

- further ideas: warnings:
- there could be warnings for any AHK v1 legacy if-statements that were not forwards compatible with AHK v2 (and similar for: assignments, loops, incomplete ternary operators, variable names starting with a digit)
- (incomplete ternary operators could trigger an error in AHK v1 as standard)



- #Warn at loadtime
- if #Warn detects errors at loadtime, there isn't currently an easy way to exit the script, other than via Task Manager, or another AHK script via ProcessClose, note: the tray icon will not yet have showed
- perhaps the MsgBox could say: continue? Yes/No (default: Yes), instead of OK

- list all functions/variables
- e.g. via an object, be able to retrieve a list of all the functions/variables in the script, and information about them, including variables that are local to functions
- a way to retrieve a list of all built-in/custom functions, built-in ('A_')/global/local variables
- e.g. the script could check for variable names starting with 'WM_'/'xl' and then set the contents for those variables cf. indiscriminately creating variables for all possible constants (in effect a 'VarExist' function)

- variable information:
- scope: local/global/static/super-global (identify variables that cause #Warn errors)
- type: Float/Integer/Object (class/object)/String
- address (this would make possible pointer to variable/object name)
- case: list any variables where the case is inconsistent (useful when searching text and when converting to other languages)
- initialised: is/isn't initialised (has it been assigned a value)
- built-in: is/isn't an A_ variable/Clipboard/ErrorLevel/False/True (ClipboardAll/ComSpec/ProgramFiles)

- list main window information (ListLines/ListVars/ListHotkeys/KeyHistory)
- retrieving the line history, key history and hotkey list, direct to a variable/via an object/'A_' variable object, would also be useful
- the hotkey list is presently a little limited, having a count for each hotkey, and/or having a list of each hotkey label in each file might be useful
- ListVars: there could be an option to display more characters e.g. the first 256 characters (to display full paths), it could also *always* show certain key A_ variables e.g. A_Index/A_LoopField/A_LoopFileFullPath (to know how far a loop is progressing)

- parsing
- list variables/functions in selected code
- code to summary e.g. var := Func(obj.key, var) -> VVV PP FFFF(OOO.KKK, VVV) [note: 'P' for operator]
- note: existing scripts: DebugVars and ScriptInfo

- sometimes all of the hotkeys stop working, although the script keeps working as usual
- solutions could include:
- a function to reregister the 'forgotten' hotkeys (which could be triggered via OnMessage)
- a function to force reload a script (or an option added to the Reload command) (which could be triggered via OnMessage)
- a function to check if a script's hotkeys are still working
- (otherwise the script needs to be reloaded)

- more granularity re. 'Could not close the previous instance of this script. Keep waiting?'
- I have a workaround here:
avoid 'Could not close the previous instance of this script' warnings - AutoHotkey Community
- e.g. WM_COMMAND with ID_FILE_RELOADSCRIPT/ID_TRAY_RELOADSCRIPT: the lParam could act as flags: (1) no warning MsgBox, (2) maintain command-line arguments
- (possibly also, a way to increase the delay between MsgBox prompts)
- (out of interest, it would be useful to understand why some scripts take longer to reload than others)

- main window: hidden Static/Edit control
- a hidden control in the main window, perhaps a Static/Edit control, just for storing a handy message/information, a 'ticker', a 'status bar' [or: there could be a menu option like 'View, Console']
- this can be used to communicate information between scripts, or the user can use it to get an update on the script's progress
- note: one idea is to change the main window's title temporarily, but this is undesirable as scripts often use this to identify windows
- I've achieved a possible workaround here:
SetWindowText and Edit controls - AutoHotkey Community
- perhaps a 'Print' menu item, an area where things are printed
- note: there could be another such control to reliably store the script's path (instead of the main window's title which could change)




- Some of these are Swiss army knife-style super-functions. Some of these versatile/powerful string/array functions, with many bits of functionality, cf. the Sort command, can be difficult to agree upon, but are worth considering.
- Sometimes simple but versatile functions can make a difference. E.g. NumOp(a, op, b) or StrOp(a, op, b), where you can specify an operator dynamically. Which would otherwise require a massive if/else ladder.

- SortedString := Sort(String [, Options, Function])
- E.g. var := Sort(var, "D`n O`r", vFuncName)
- E.g. var := Sort(var, "D`n O`r", oFunc)

- String parameter: handle linear arrays
- (Options parameter: original options: C CL Dx F N Pn R Random U Z \, note: the F option was removed in AHK v2)
- possible options (different letters can be used):
- Options parameter: S1/S0/S (or T1/T0/T) option: stable sort [and a variable to make it on/off by default: e.g. A_SortMode(/A_SortStable), on at script start][if 2 items are considered identical, maintain their order]
- Options parameter: X option: null sort (e.g. null sort + existing R option = reverse without sorting)
- Options parameter: O option: omit characters
- Options parameter: XD option: no delimiters, sort individual characters (e.g. alphabetise/reverse/shuffle)

- (perhaps also: StrAlphabetize/StrReverse/StrShuffle) [or StrRandomize]
- (other minor features:)
Sort function + extra features - AutoHotkey Community

- possibly: Sort(String [, Options, Function, Delimiters, OmitChars]), delim/omit params to match StrSplit, in addition to D option
- possible functionality: remove duplicates without sorting
- possible functionality: remove all duplicates/adjacent duplicates only

- note re. omit characters:
minor bug: Sort command's handling of LFs/CRLFs - AutoHotkey Community

- faster than RegEx (^exact$/contains/^starts/ends$)
- no RegEx escaping issues
- case sensitivity option
- numeric/string comparison option [or possibly a NumEquals function]
- (or perhaps: StrContains/StrExact, StrStarts/StrEnds) [or StrEquals instead of StrExact][see also: A_DetectHiddenWindows]
simplest way to make a RegEx needle literal? - AutoHotkey Community
if var in/contains comma-separated list/array - AutoHotkey Community
Improve InStr or IfInString - AutoHotkey Community

Code: Select all

StrContains(vHaystack, vNeedles, vOpt, ByRef vMatch)
StrEnds(vHaystack, vNeedles, vOpt, ByRef vMatch)
StrExact(vHaystack, vNeedles, vOpt, ByRef vMatch)
StrStarts(vHaystack, vNeedles, vOpt, ByRef vMatch)

StrMatch(vHaystack, vNeedles, vOpt, ByRef vMatch)
[Base64Get/Base64Put and HexGet/HexPut]
StrPut/StrGet + hex/base64 - AutoHotkey Community

- get specific keys/values from an array
- [ObjGetVals]['ObjMatch']
object get keys/values prototype function - AutoHotkey Community


BaseToDec / DecToBase - AutoHotkey Community

Allow AutoHotkey to Handle Binary Data - AutoHotkey Community

Being more generic when using WinActivate and ControlSetText - AutoHotkey Community

[DateGet][or A_NowMSec/A_NowMSecUTC][or A_MSecLast, the milliseconds at the time you last retrieved A_Now/A_NowUTC]
- you cannot reliably do vDate := A_Now A_MSec
- or concatenate any date variables
A_ variables - AutoHotkey Community

file get part (SplitPath alternative/short-form/long-form/correct case) - AutoHotkey Community

[FileSetText(/FileWrite), FileGetEncoding, FileEmpty]
file set text/empty/get encoding/force read with specific encoding - AutoHotkey Community

FloorDiv / FloorMod (and an 'always positive' Mod function) - AutoHotkey Community

[MsgBox/InputBox/InputBoxMulti/Progress/SplashImage/ToolTip/Borders (SplashBorder)]
slightly-improved dialogs - AutoHotkey Community

How to check if active window runs as admin? - AutoHotkey Community

[Range][similar to Excel VBA for loop: start end step][e.g. -10 to 10 inclusive in 0.5 increments]
For loop question - Ask for Help - AutoHotkey Community
traditional for loop: for i = a to b (step c) possibilities - AutoHotkey Community

prototype 'RegEx match all' function - AutoHotkey Community

[StrHatch/StrDelimit][add a string every n characters]
[StrPad][add characters to the start/end of a string]
slice string, pad characters - AutoHotkey Community

[StrJoin (with alternating join string)]
StrUnused prototype function: find unused characters for use as delimiters/separators - AutoHotkey Community

StrRept and StrCount - AutoHotkey Community

StrUnused prototype function: find unused characters for use as delimiters/separators - AutoHotkey Community

swap bytes - AutoHotkey Community

combinations and permutations (and anagrams) - AutoHotkey Community

[big integer functions]
Decimal to Base64 conversion + Custom character list - AutoHotkey Community

Num / IsNum / Int / Float / Str - AutoHotkey Community

Swap / ObjSwap / Assign / Sign - AutoHotkey Community


[some simple but bold ideas][my prediction of the fundamental features that users will want]
objects/object classes: new features from a newbie-friendly perspective - AutoHotkey Community
Objects+ - AutoHotkey Community


C++: AHK source code: potential functions - AutoHotkey Community

C++: AHK source code: potential A_ variables - AutoHotkey Community



- [note: some of the better ideas are marked '[PRIORITY]']
- [note: some deprecated ideas have been moved lower down and marked '[MINOR]']

- A_Bitness and/or A_Arch (or something like it) to give 64/32 and/or 64/86, which might be useful for use with #Include
- A_Extra1, A_Extra2, variables that could be set with something like a #Set directive based on a condition, for possible use with #Include
- A_MouseSwapMode(/A_MouseButtonsSwapped/A_MouseButtonSwap/A_MouseSwapButtons)
- A_Sp (v. A_Space), A_Field (v. A_LoopField) (in addition to the existing variables)
- [PRIORITY] A_ThisHotkeyHwnd: the matching (e.g. active) window at the time the hotkey was triggered
- [PRIORITY] A_ThisHotkeyRaw (hotkey names with/without the leading *~$) (could also apply to hotstring, to strip the leading ::/:*: etc) (also, could be used to return the exact case of the characters that triggered the hotstring)
- A_ZBIndex: zero-based index version of A_Index for loops
- control focus: in AHK v2, ControlGetFocus gets the focused control irrespective of the active window, applying ControlGetFocus relative to the active window, and failing if the focused control is not a control of the active window, might be useful
- delay: a general delay between line executions that can be turned on and off, e.g. Run Sleep Run Sleep
- [PRIORITY] FileGetBitness/FileGetInfo/ProcessGetBitness/ProcessIs64Bit: determine if a process/exe/dll is 64-bit/32-bit/16-bit [only FileGetBitness/FileGetBits is priority]
- FileRead/File object: consistent unknown character: ? v. Chr(0xFFFD)
- FileSetText(/FileWrite) function (and/or 'FileEmpty'/'FileGetEncoding' functions)
- GUI: create a control by specifying 'Static' rather than 'Text' or 'Picture', this always catches me out
- [PRIORITY] hotkey 'does not exist in the current keyboard layout': perhaps some alternative options for handling this (perhaps something in the #Warn directive to optionally prevent an error message)
- if (var is "ascii") equivalent to: vIsAscii := !RegExMatch(vText, "[^[:ascii:]]")
- Loop Files: allow arrays for FilePattern and Mode, to search in multiple folders.
- [PRIORITY] OnWarn: specify a function to handle warnings (however, some messages would occur before the script had started)
- [PRIORITY] panic button: support(/documentation guidance) to help stop a script, start/stop a hotkey subroutine (with the same hotkey/with different hotkeys)
- [PRIORITY] PathGetCorrectCase function (or FileGetCorrectCase) [a FileGetPart/PathGetPart function could do this]
- registry loop: an option to retrieve keys (and perhaps values) in alphabetical order (e.g. a letter, 'A', cf. V/K/R, or an 'A_' variable) [StrJoinReverse or Sort 'reverse without sorting' would be good alternatives for reversing a list]
- RGBToBGR function, perhaps with an ARGB to BGRA option, or a more general swap bytes function
- Send: {Event}/{Input}/{Play} options (and a {Sleep 100} etc option)
- #SingleInstance prompt (or dialog): explicitly specify to show a dialog box (the default behaviour when #SingleInstance is not used)
- #Speed directive (or equivalent functionality by some other means): set multiple defaults for increased speed
- StatusBarGetText/StatusBarWait: add a Control parameter (versus forced to use 'msctls_statusbar321')
- StrReplace: perhaps allow StrReplace's SearchText/ReplaceText parameters to accept arrays, in order to do replace multiple string replacements
- trig functions (Sin/Cos/Tan/ASin/ACos/ATan): add a parameter to accept "d", to use degrees

- big integers: more general support for big integers (and/or infinite precision), perhaps by treating numbers as strings (note: AHK only supports Int64 natively, not UInt64, however, there are workarounds regarding UInt64)
- Combin/Permut functions (that can handle with/without repetitions).
- Fact function (factorial function).

- [MINOR] 'can be an expression': % %var% should work consistently across all parameters, currently in 'can be an expression' parameters, this is interpreted as % var, i.e. one would hope that if you prefix a parameter with '% ', you should be safe, you should get what you expect, it should work exactly as it would in a function parameter
- [MINOR] A_CoordModeControl [for use with ControlClick/ControlGetPos/ControlMove][AHK v1 uses Window coordinates, AHK v2 uses Client coordinates][Client is more useful, Window is hardly useful][I've created custom functions for the easy conversion of AHK v1 scripts (allowing X/Y values to be preserved)][EDIT: I've accepted that it might be better only to allow Client coordinates, as AHK v2 does]
- [MINOR] Between: Between(vNum, vLim1, vLim2, vOpt:="ii") where i/x indicates inclusive/exclusive (equivalent to <= / <), making the function 4 times more useful than the operator was. [EDIT: i/x might be too esoteric]
- [MINOR] ControlGetFocusClass/ControlGetFocusClassNN/ControlGetClass
- [MINOR] def/func keyword required for all function definitions (cf. class keyword)
- [MINOR] defer functionality
- [MINOR] Deref function
- [MINOR] FloorDiv(Num1, Num2) and IntDiv(Num1, Num2) [note: Floor(Num1/Num2) and Integer(Num1/Num2) are already possible]
- [MINOR] for loop: a symbol, that if used for the key, prevents a variable being created for it: e.g. for ~, vValue in oArray
- [MINOR] FormatTime: 'FormatTime, vWDay, % vDate, WDay' gives 2 even when the date is invalid, but if that's just the behaviour of the Winapi function, then that's a legitimate argument to do nothing re. this
- [MINOR] func MyFunc: equivalent to class MyClass
- [MINOR] functions: option where if a function already exists, to ignore secondary definitions (rather than prevent a script from loading) (I can see potential arguments against this, although if the user opted to do this via a directive, it could potentially be a good idea)
- [MINOR] functions: the ability to refer to variables from the scope of where the variable was called e.g. to be able to create a Deref function in AHK v1/v2, note: RegExMatch variable mode and StringSplit also have this ability (cf. variables that are local to a function, global variables v. variables that are local to where the function was called from) (an alternative would be to restore the Deref function to AHK v2, and introduce it to AHK v1, the functionality already exists in AHK v1 via the Transform command)
- [MINOR] hotstrings: special hotstrings: define a hotstring in a similar way to a Send line (i.e. any key presses used with Send can be used to trigger a hotstring)
- [MINOR] InStrRev function: like InStr but that would search in reverse and accept positive values for positions
- [MINOR] not: 'not' could have the same precedence as ! (I don't use 'not')
- [MINOR] NumGet/NumPut/StrGet/StrPut: smart parameters could be removed (parameters are either used or omitted)
- [MINOR] NumGet/NumPut: 'Offset' could be removed
- [MINOR] object classes: obj := new %class%, perhaps a blank or other string to create a built-in array [actually, this is possible: obj := (class = "") ? {} : new %class%]
- [MINOR] objects: IsArray function (true if: empty array or contains only keys from 1 to .Length(), with no gaps)
- [MINOR] RegExMatch: V mode, outputs the entire match to a variable [but unlike AHK v1, no other pseudo-array variables]
- [MINOR] Send: combine Send/ControlSend AHK v2 functions [or: optional control/window parameters for Send]
- [MINOR] StrLeft/StrRight/StrTrimLeft/StrTrimRight
- [MINOR] StrJoinReverse (could be handled by an improved Sort function and StrJoin instead)
- [MINOR] VarSetCapacity: 1-parameter mode, accept A_ variables
- [MINOR] WinClick
- [MINOR] WinXXX/ControlXXX functions etc: remove ExcludeTitle/ExcludeText parameters

[Wish List 1.0]
jeeswg's 3-item wish list (GUI class name+GUI no icon, A_ThisHwnd/A_ThisIfWinCriteria on hotkey launch, InputBox HFONT) - AutoHotkey Community

Thanks for reading.


Last edited by jeeswg on 22 Aug 2019, 17:02, edited 465 times in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 2435
Joined: 30 Sep 2013, 01:33
GitHub: jNizM

Re: Wish List 2.0

08 Sep 2017, 02:00

jeeswg wrote:>>> return/continue/break in multi-statements
- e.g. when the script runs, the original code:

Code: Select all

var1 := 1, var2 := 2, var3 := 3, return
would be converted by AHK to:

Code: Select all

	var1 := 1, var2 := 2, var3 := 3
This one works:

Code: Select all

return, var1 := 1

jeeswg wrote:A_ScriptPID: the script's PID
it's already a one-liner -> MsgBox % DllCall("GetCurrentProcess")

jeeswg wrote:>>> ProcessIs64Bit
MsgBox % DllCall("IsWow64Process", "ptr", DllCall("GetCurrentProcess"), "int*", IsWow64) && IsWow64
[AHK] x64 Unicode | [WIN] 10 Pro (Version 1903) x64 | [GitHub] Profile
Donations are appreciated if I could help you
just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Wish List 2.0

08 Sep 2017, 03:02

New features are outside the scope of AHK v2.0.
AutoHotkey v2 wrote:The focus of v2 is on changes that cannot be made in v1 due to backward compatibility. As such, new features which do not require a break in compatibility are outside the scope of v2. Most scripts written for AutoHotkey v1 will require some changes in order to run on AutoHotkey v2.
Posts: 3862
Joined: 17 Jul 2016, 01:02

Re: Wish List 2.0

08 Sep 2017, 03:10

Just me, I think 2.0 means that this is jeeswg's second wish list, not that these are intended (exclusively) for v2.
Jeeswg, I'll return if I have comments.

Cheers. :angel:
just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Wish List 2.0

08 Sep 2017, 03:18

Oops, I thought to be in the AutoHotkey v2 Development section. Sorry!
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

08 Sep 2017, 03:21

@Helgef: Yes, you're quite right Helgef. I've added a title to the top to make it clearer. I had initially wanted the post to get straight into the action, no messing around. Looking forward to any responses.

@just me: Well, new features have been added though e.g. DirExist and Type. [EDIT:] No problem just me.


@jNizM: Re. ProcessIs64Bit and A_ScriptPID. And A_ScriptNameNoExt/A_LoopFileNameNoExt which I didn't mention in the OP.

Re. ProcessIs64Bit. To check if a process is 64-bit:

Code: Select all

;To check if AutoHotkey is 64-bit:
MsgBox, % (A_PtrSize = 8)
;But for external processes you have to use OpenProcess e.g.:
	if !A_Is64bitOS
		return 0
	hProc := DllCall("kernel32\OpenProcess", UInt,0x400, Int,0, UInt,vPID, Ptr)
	DllCall("kernel32\IsWow64Process", Ptr,hProc, IntP,vIsWow64Process)
	DllCall("kernel32\CloseHandle", Ptr,hProc)
	return !vIsWow64Process
Re. A_ScriptPID. To get AutoHotkey's PID I use:
vPIDAhk := DllCall("kernel32\GetCurrentProcessId", UInt)
This was a subtle one re. whether to advocate for it, however I use this often enough, and I think for newbie friendliness and consistency with other AHK variables, a case could be made for its inclusion. My instinct would be to add it to AutoHotkey.

Two built-in variables I did consider, but didn't post above were:
- A_ScriptNameNoExt (for use with MsgBox/InputBox/GUIs)
- A_LoopFileNameNoExt
Because using SplitPath for this is inconvenient, even in AHK v2, since the outputs are ByRef variables, and not the direct output of a function.
However, a RegEx one-liner can obtain these:

Code: Select all

;path/name to name no extension
MsgBox, % vNameNoExt := RegExReplace(A_ScriptName, ".*\\|\.[^.]*$") ;remove dir and ext
MsgBox, % vNameNoExt := RegExReplace(A_ScriptFullPath, ".*\\|\.[^.]*$") ;remove dir and ext

;remove extension (path to path no extension) (name to name no extension)
MsgBox, % vNameNoExt := RegExReplace(A_ScriptName, "\.[^.\\]*$") ;remove ext
MsgBox, % vPathNoExt := RegExReplace(A_ScriptFullPath, "\.[^.\\]*$") ;remove ext
I did consider also, a sort of FileGetPart function, to pick one of SplitPath's output variables, but all of this can be done via a file loop or via RegExReplace, so I didn't feel it absolutely necessary. RegEx examples at:
jeeswg's RegEx tutorial (RegExMatch, RegExReplace) - AutoHotkey Community

Re. break/continue/return, yes that's true, but it only applies to return, and it only applies within functions.
One related thing that is possible: var1 := 1, var2 := 2, var3 := 3, Exit()
Last edited by jeeswg on 17 Feb 2019, 17:47, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 367
Joined: 29 Sep 2013, 16:58

Re: Wish List 2.0

10 Sep 2017, 12:12

Nice list, jeeswg :)

Big-endian encoded number occurs mostly in files.
Something like: File.ReadHEX( Bytes ) would be very helpful.
While at it, I would also like to suggest File.BinSearch( needle as hex )
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

12 Sep 2017, 08:07

@SKAN: Thanks for the positive comments. Yes, the idea re. BinSearch is interesting, perhaps similar to the RegExMatch 'ANSI mode' that I mentioned above.

Here's the best I have for binary search so far:
InBuf function currently 32-bit only (machine code binary buffer searching) - AutoHotkey Community
RegExMatch on binary data from FileRead - AutoHotkey Community


I've provided some example code here relating to FileSetText/FileEmpty. I suppose another approach would be to use AHK's FileDelete, and the GetFileTime/SetFileTime Winapi functions, if you wanted to keep the creation and/or modified dates.

Code: Select all

q:: ;file - empty file, set text, change encoding, keep original datestamps
vPath = %A_Desktop%\z %A_Now%.txt
FileAppend, % "version 1", % "*" vPath, UTF-8
FileGetTime, vDateM1, % vPath, M
Sleep 3000 ;to check that when we retrieve the modified date, it has the original date, not the date 3 seconds later
oFile := FileOpen(vPath, "rw")
;MsgBox, % oFile.Encoding ;e.g. CP1252/UTF-8/UTF-16
DllCall("GetFileTime", Ptr,oFile.__Handle, Int64P,vDateC, Int64P,vDateA, Int64P,vDateM)
oFile.Encoding := "UTF-16"
;oFile.Encoding := "UTF-8"
;oFile.Encoding := "CP0"
;oFile.Encoding := "CP1252"
oFile.Length := 0 ;empty file
if (SubStr(oFile.Encoding, 1, 4) = "UTF-")
	oFile.Write(Chr(0xFEFF)) ;oFile.Write overwrites characters
oFile.Write("VERS 2")
DllCall("SetFileTime", Ptr,oFile.__Handle, Int64P,vDateC, Int64P,vDateA, Int64P,vDateM)
FileGetTime, vDateM2, % vPath, M
MsgBox, % vDateM1 "`r`n" vDateM2
Run, % vPath

[EDIT:] I've come up with a workaround script re. A_TimeIdlePhysical and ignoring mouse movement.
A_TimeIdlePhysical to detect any input but not mouse movement? - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 50#p170250

[EDIT:] Btw Wish List 1.0 for anyone curious:
jeeswg's 3-item wish list (GUI class name+GUI no icon, A_ThisHwnd/A_ThisIfWinCriteria on hotkey launch, InputBox HFONT) - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 13&t=26180
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

21 Sep 2017, 18:54

I've completed investigating issues relating to UInt64. It appears that you can specify UInt64 for DllCall/NumGet/NumPut, even though this is not stated explicitly for NumGet/NumPut. DllCall/NumGet/NumPut will then use/return an Int64.

It also appears that the Format command can already display an Int64 as a UInt64 (as dec or hex), but AFAIK AutoHotkey does not have a standard way to convert a dec/hex UInt64 number stored as a string to an Int64, although this can be done via mathematics and string manipulation.

I had wondered if Laszlo had said anything on the matter, and it turns out that indeed he had:
UInt64 <--> Int64: Using large unsigned hex/decimals - Scripts and Functions - AutoHotkey Community
https://autohotkey.com/board/topic/1688 ... xdecimals/
AHK cannot process UINT64 numbers directly. Literal integers larger than 2**63-1 are treated as overflow, and replaced by 0x7fffffffffffffff. If you get these numbers from other applications (like from majkinetor's hex viewer), you have to convert them to signed Int64 numbers, to let them wrap around (treating the leftmost bit as sign). After processing we can convert them back to UInt64. Here are functions for this.
Here is some collected code re. Int64/UInt64 issues.

Code: Select all

q:: ;UInt64 binary to Int64 number to UInt64 string
vText := Chr(65535) Chr(65535) Chr(65535) Chr(65535)
MsgBox, % NumGet(&vText, 0, "Int64")
MsgBox, % NumGet(&vText, 0, "UInt64")
vNum := NumGet(&vText, 0, "UInt64")
MsgBox, % Format("0x{:X}", vNum)
MsgBox, % Format("{:u}", vNum)
MsgBox, % JEE_FormatInt64(vNum)
MsgBox, % JEE_FormatInt64(vNum, "0x%I64X")

NumPut(-2, &vText, 0, "UInt64")
MsgBox, % NumGet(&vText, 0, "Int64")
MsgBox, % NumGet(&vText, 0, "UInt64")
vNum := NumGet(&vText, 0, "UInt64")
MsgBox, % Format("0x{:X}", vNum)
MsgBox, % Format("{:u}", vNum)

;doesn't work:
MsgBox, % vNum
MsgBox, % Format("0x{:X}", vNum)
MsgBox, % Format("{:u}", vNum)
MsgBox, % JEE_FormatInt64(vNum)
MsgBox, % JEE_FormatInt64(vNum, "0x%I64X")

w:: ;UInt64 string to Int64 number
;doesn't work:
MsgBox, % Format("0x{:X}", "0xFFFFFFFFFFFFFFFF")
MsgBox, % Format("{:i}", "0xFFFFFFFFFFFFFFFF")

;does work
d := "18446744073709551615"
;code by Laszlo (modified to make it AHK v1/v2 two-way compatible)
MsgBox, % StrLen(x) < 18 ? x : (SubStr(x,1,StrLen(x)-1)<<4) + abs("0x" . SubStr(x,StrLen(x)))
MsgBox, % StrLen(d) < 19 ? d : SubStr(d,1,StrLen(d)-2)*100 + SubStr(d,StrLen(d)-1)

JEE_FormatInt64(vNum, vFormat:="%I64u")
	local vNum2
	VarSetCapacity(vNum2, A_IsUnicode?40:20, 0)
	DllCall(A_IsUnicode?"wsprintf":"sprintf", Str,vNum2, Str,vFormat, Int64,vNum)
	return vNum2

[EDIT:] I had been concerned about bitshifting an Int into an Int64/UInt64, e.g. for POINT structures, but it turns out that AutoHotkey can already handle this situation.

Btw for a 'MakeUInt64' function (from low/high values), you have to be very careful re. the order in which you specify things, i.e. you have to remember the little endian nature of how the numbers are treated.

Code: Select all

q:: ;POINT structures e.g. WindowFromPoint and AccessibleObjectFromPoint
;vPosX := -1, vPosY := -1
;vPosX := 1, vPosY := 2
;vPosX := 0xFFFFFFFF, vPosY := 0xFFFFFFFF
;vPosX := 0xFFFFFFFE, vPosY := 0xFFFFFFFE
vPosX := A_ScreenWidth/2, vPosY := A_ScreenHeight/2

MsgBox, % (vPosX&0xFFFFFFFF)|(vPosY<<32)
MsgBox, % JEE_MakeUInt64(vPosX, vPosY)

hWnd1 := DllCall("WindowFromPoint", UInt64,(vPosX&0xFFFFFFFF)|(vPosY<<32), Ptr)
hWnd2 := DllCall("WindowFromPoint", UInt64,JEE_MakeUInt64(vPosX, vPosY), Ptr)
WinGetClass, vWinClass1, % "ahk_id " hWnd1
WinGetClass, vWinClass2, % "ahk_id " hWnd2
MsgBox, % hWnd1 " " vWinClass1 "`r`n" hWnd2 " " vWinClass2

;note: this actually returns an Int64 in AHK v1 (and probably in AHK v2)
JEE_MakeUInt64(vLow, vHigh)
	local vData
	VarSetCapacity(vData, 8)
	NumPut(vLow, &vData, 0, "UInt")
	NumPut(vHigh, &vData, 4, "UInt")
	return NumGet(&vData, 0, "UInt64")
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Posts: 3862
Joined: 17 Jul 2016, 01:02

Re: Wish List 2.0

27 Sep 2017, 17:51

Hello jeeswg, nice list, thanks for sharing your ideas :thumbup:. There are a few I don't get though :crazy: ;) .
Quite a few of the suggestions are probably trivial to implement in either script/binary code or ahk-source.

Posts: 3862
Joined: 17 Jul 2016, 01:02

Re: Wish List 2.0

31 Oct 2017, 13:15

helgef wrote:There are a few I don't get
For the sake of being fair, I will try to be more specific, and also make some comments :xmas:
I do not understand what is
  • Verbatim (or an alternative name)
    • Especially, but not limited to, a one-line continuation section
    • the options for creating certain strings, example?
  • SetAhkV2Mode, I understand the meaning, but I cannot realise the reason.
I comment on:
>> 'Could not close the previous instance of this script. Keep waiting?'
- make this error message less likely
Sounds like poor scripting, I (almost) never see that :D
I thought I would have more comments, I must have forgotten while reading. If I can cope, I might return :wave:


Regarding min/max functions, Ragnar-F has submitted such a function pair, see #84. :thumbup:
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

31 Oct 2017, 15:12

- Verbatim
- There always comes a time when you need to paste text into a script verbatim. Sometimes it's convenience, sometimes it's necessity.
- var := "value" is great 90% of the time.
- var = value had some definite advantages, and could live on as a Verbatim 'command'.
- Continuation sections can achieve this, but you need 4 lines to define 1 line which is inconvenient.
- Continuation sections are also very inconvenient regarding script parsing and conversion, and for this reason I'm eliminating all continuation sections from my major scripts and using . "`r`n" instead. Ideally I would use . "`r`n" and a Deref function.
- The Verbatim command could be made more useful by adding some options, that make it, ironically enough, non-verbatim.
- One key usage would be for assigning paths e.g.

Code: Select all

Verbatim, "d%", vTarget, "%vPathExe%" "%vPath%"
Verbatim, "d{}", vTarget, "{vPathExe}" "{vPath}"
Verbatim, "d%", vTarget, "%obj.PathExe%" "%obj.Path%"
Verbatim, "d{}", vTarget, "{obj.PathExe}" "{obj.Path}"
Verbatim, "d%", vPath, %vDir%\%vNameNoExt%%vSfx%.%vExt%
Verbatim, "d% e1", vPath, C:\Users\%username%\Start Menu\Programs\Startup
- '"C:\MyFile"': single/double quotes can merge into each other. Indeed you can't tell whether it's single then double, or double then single. At least, you could tell if single quotes for assignments were dropped.
- The use of single quotes for assignments, a lot of people don't like this because they consider it unsightly. To be honest, AutoHotkey v2 would be better off without assigning text between single quotes, it's really really ugly. myvar := 'text'. I respect the rationale in introducing it, I believe it's fairly common in programming languages, however, I have had enough problems with parsing html because of the single/double quote duality, so I believe it would do more harm than good. Plus the rationale behind AutoHotkey version TWO, seems to be to prevent there being TWO ways of doing everything. [EDIT: I was basically joking here, I accepted a long time ago that single quote support would be added in.]
- When AutoHotkey or custom scripts parse the script, it's relatively straightforward to identify the Verbatim lines, which inevitably disobey some of the standard rules re. characters.
- See:
AHK v2 and strings - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 65#p173365


- SetAhkV2Mode
- First of all the way InStr/SubStr/RegEx(Match|Replace) handle negative offsets was never ideal in my opinion, so this would fix AHK v1.
- Similarly A_OSVersion was flawed to use names and not numbers. Although I respect the rationale in making it newb-friendly. So this would again fix AHK v1.
- I don't know how feasible it would be to make Loop's behaviour variable, perhaps a directive is needed for this rather than a command, I'm not sure. However, I think people glibly underestimate sometimes the inconvenience of issues relating to conversion, and at the moment Loop is by far the biggest problem re. both conversion and two-way compatibility.
- I can replace commands with functions, but there are certain things I can't fix by myself. The way control flow statements/directives/functions work is beyond the user's control, plus other issues such as A_Args, double quote handling, a Deref function (variables and scope), and syntax generally.
- These changes would of course be very useful regarding two-way compatibility, otherwise you need some ugly workarounds:
- InStr:

Code: Select all

vIsV1 := !!InStr(1,1,1,0)
vPos := InStr(vText, vNeedle, 0, vIsV1-1)
Also things like RegExMatch with $ are workarounds.
- SubStr:

Code: Select all

vIsV1 := !!SubStr(1,0)
vOutput := SubStr(vText, vIsV1-4)

vOutput := SubStr(vText, StrLen(vText)-4+1)
Also things like RTrim or RegExReplace with $ are workarounds.
- RegExMatch:

Code: Select all

RegExMatch("", "", o)
vPfx := IsObject(o) ? "" : "O"
RegExMatch(vText, vPfx vNeedle, oMatch)

RegExMatch("", "", o)
vPfx := IsObject(o) ? "" : "O)"
RegExMatch(vText, vPfx vNeedle, oMatch)
- The sooner something like this were to be implemented, the sooner you could share good quality future compatible AHK v1 scripts without ugly workarounds. In effect I'm compromising my code at the moment, or over-thinking code, because I know how much bother it will cause newbs when they try to run/convert AHK v1-only scripts in AHK v2. I had thought about simply not submitting code to the forum until AHK v2 was released, but I believe my current approach is the lesser of two evils.


- Min/Max
- That's great re. Min/Max, people are welcome to submit any of the proposals in Wish List 2.0 to GitHub.

I (almost) never see that
Funnily enough, I've hardly seen it all recently. However, on my smaller laptop with hardly any resources, and sometimes when this PC's going at full pelt, all of the hotkeys stop working, and I often get that message when I try to reload scripts in such cases.

If I can cope
Can't be as bad as when I attempted Puzzle 5.
Code Puzzle Thread - Page 2 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 22#p140122

Or reading the documentation on objects for the first time. #AChallenge.

Obviously I did a good job going over each item and clarifying it. Many thanks @Helgef.
Last edited by jeeswg on 07 Jan 2018, 00:37, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 4236
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Wish List 2.0

31 Oct 2017, 15:21

So instead of changing your language parser to properly parse your code you want to adjust the language?
Recommends AHK Studio
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

10 Dec 2017, 11:29

- I will, at least I guess I will have to, extend my parser to handle any future syntax changes. The important point was to 'extol the vices' of single quotes, and yet at the same time, accept their arrival.
- Actually, adjusting the language due to parsing considerations, is a very important thing to do, and is a running theme behind some of the changes that are being made in AHK v2. Clearly, when you have situations where there are code lines that are ambiguous to parse, a lot of thought is put into that re. any necessary amendments to the syntax. I'm experiencing every tiny detail of script parsing, as I work on my script 'tidiers' and converters.

- Btw, while I'm here posting, I'd like to point out that although many of these suggestions are very simple, and can be made as custom functions, it's precisely their commonality that makes them candidates for inclusion as standard parts of AutoHotkey. Do I have to include functions XYZ, every time I want to do simple task ABC.
- The nature of anything is that things develop, and random simple obvious things (bits of functionality), get left out along the way. We could say for example that we could relegate WinGet-ProcessPath back to the status of custom function. Truncating numbers or repeating strings, these things are just so everyday, and for example, Excel has sheet functions for these. Before Format and StrReplace, some things were a real chore in AutoHotkey.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

07 Jan 2018, 00:53

Wish List 2.0: now simplified and restructured.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

15 Feb 2018, 17:37

Wish List 2.0: first half reordered, duplicated content reduced, occasional additional information/links added.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

07 Apr 2018, 00:15

I've added a 'BASICS' section, this is a collection of simple ideas mentioned elsewhere in the list, that are quite straightforward and uncontroversial. A core of suggested improvements to fill out AutoHotkey's functionality.

[EDIT:] Backup of BASICS section.

Code: Select all



- A_AhkDir, A_AhkName
- A_AhkNameNoExt, A_LoopFileNameNoExt, A_ScriptNameNoExt
- A_CoordModeControl
- A_DlgTitle(/A_GuiTitle/A_DefaultTitle) (keep A_ScriptName read-only)
- A_ScriptPID

- redefine a built-in function, but maintain access to the original

- DateAdd: add a Format parameter (default value: 'yyyyMMddHHmmss')

- InputBox: Options parameter: specify HFONT:hFont
- InputBox: Options parameter: specify no Edit control (a MsgBox alternative)

- file loop: handle long filenames
- FileSetText (or FileWrite), and/or FileGetEncoding/FileEmpty

- GUI control objects: oGui.HwndParent
- GUI menu objects: specify menu item IDs (e.g. for use with accelerator keys and compatibility with other programs)
- GUI objects: oGui.Pos.B, oGui.Pos.R (bottom/right)
- GuiFromHwnd: take over a GUI window created via DllCall
- [bonus] GUI objects: create controls by class names, so 'Static' in addition to 'Text' and 'Picture'
- [bonus] GUI objects: increased support for setting the colour of a control (add it for more control types)

- Between: e.g. Between(vNum, vLim1, vLim2)
- Ceil/Floor: a Places parameter consistent with Round

- Count method

- RegCreateKey

- [bonus] Send: combine Send/ControlSend AHK v2 functions
- [bonus] Send: {Event}/{Input}/{Play}/{Sleep n} options

- support for stable sort (a variable to make it default: A_SortMode/A_SortStable)
- [bonus] handle a linear array

- StrJoin
- StrRept StrRept StrRept
- SubStr: a blank Length parameter to mean infinity (equivalent to omitting the parameter)
- [bonus] FileGetPart (or another name): e.g. FileGetPart(vPath, "n") to get name, (n/d/x or e/nnx or nne/dr/pnx or pne)
- [bonus] StrCount
- [bonus] StrJoinReverse

- ControlGetFocusHwnd
- ProcessIs64Bit
- WinGetOwner, WinSetOwner
- WinGetParent, WinSetParent
- window criteria: ahk_dhw (V/VH/H) (DetectHiddenWindows)
- window criteria: ahk_mode (S/C/X/E/R) (SetTitleMatchMode) (E: ends)

- [bonus] PixelGetColor/PixelSearch: BGR option in AHK v2
- [bonus] and/or RGBToBGR function, perhaps with ARGB to BGRA option
- [bonus] or a swap bytes function

- #SuspendExempt
- A_AllowMainWindow, A_IconHidden, A_IconTip
- A_InitialWorkingDir
- DateAdd, DateDiff
- DirExist
- FileInstall
- (writable 'A_' variables)

homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Posts: 6559
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Wish List 2.0

01 Sep 2018, 00:41

- I have done a complete overhaul of the wish list in the OP.
- Here is a backup copy of the old one:
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 10 guests