Wish List 2.0

Propose new features and changes
User avatar
Posts: 4782
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: 2018-07-31]

- High CPU usage often makes scripts forget their hotkeys. A function to make a script re-register its hotkeys would be very useful. Otherwise scripts need to be restarted and you can get multiple messages like this: 'Could not close the previous instance of this script. Keep waiting?'. (E.g. 6 messages for 6 scripts = 36 prompts.) More granular control over this would be useful e.g. try for 10 seconds, MsgBox once, if fail, terminate the process and reopen.

- Loop (AHK v1/v2 two-way compatible, perhaps 'Loop Parse' to 'LoopParse' etc, perhaps a mode for AHK v1) [also, allowing this would be useful: for vKey, A_LoopField in oArray]
- IsNum/IsNumber function [also: if (var is type) to work consistently in AHK v1/v2 when parentheses are used][note: > < >= <= = <> != work consistently in AHK v1/v2 when parentheses are used, but differ sometimes when they are not used]
- redefine a built-in function, but maintain access to the original
[e.g. log every time a built-in function is used, make possible custom functions to backport changes to AHK v2 functions, to AHK v1, check a variable in order to end a subroutine] [An OnReturn function would be useful, to specify a function to execute each time just before a return is done.]
- A_MsgBoxResult / A_InputBoxResult, make it easier to replace IfMsgBox/if ErrorLevel lines when converting from AHK v1 to v2
- window criteria: ahk_dhw (V/VH/H) and ahk_mode (S/C/X/E/R) [perhaps also case sensitive/insensitive, perhaps it should be case insensitive by default]
[this could drastically improve various custom functions/scripts that have to set/reset modes prior to a return, and for use in #If lines, and for script use generally]
[also: increasingly many windows have a variable class name, thus necessitating a RegEx match, but 'SetTitleMatchMode, RegEx' would affect all #IfWin lines]
[perhaps also: add ahk_xtitle, ahk_xtext etc, to exclude items, and remove the ExcludeTitle/ExcludeText parameters]
- StrJoin (note: the prototype allows alternating 'join' characters/strings):
StrUnused prototype function: find unused characters for use as delimiters/separators - AutoHotkey Community
- StrRept: repeat a string
StrRept and StrCount - AutoHotkey Community

- A_AhkDir/A_AhkNameNoExt/A_ScriptNameNoExt
e.g. #Include %A_AhkDir%\%A_AhkNameNoExt% Options.txt (options file for AHK exe)
e.g. #Include %A_ScriptDir%\%A_ScriptNameNoExt% Options.txt (options file for AHK script/compiled exe)
(and A_AhkName/A_LoopFileNameNoExt for consistency/added utility)
(to #Include option files for exes/scripts, to refer to a file consistently whether compiled or not, for use with MsgBox/InputBox/GUI titles)
- A_DlgTitle(/A_GuiTitle/A_DefaultTitle) for use with MsgBox/InputBox (i.e. keep A_ScriptName dependable as read-only)
- #Warn: Mode to notify of any variable inside a function that is not explicitly defined as local(/static) or global. [Or instead: the ability to get information about all variables in the script, at the script start and/or live.]
- Sort: add stable sort (e.g. an A_SortMode/A_SortStable variable, and/or Sort command option) [unstable sort by default can unexpectedly reorder data and is newbie-unfriendly]
- Var `= VerbatimText, or Verbatim, Var, VerbatimText, or SomeCmdName, Var, Opt, Text [with hardcoded options e.g. treat `t as tab]
- see also: the 'conversion obstacles' and 'conversion obstacles (further)' sections below


Note: Any names for directives/functions/variables are suggestions only, and can be changed.
Note: I have been undecided re. 'Exact/X' v. 'Whole/W' for ahk_mode and various string functions (including a function version of the 'in' operator). But overall I think that 'Exact/X' is better.

new unsorted ideas:
- perhaps for non-variadic functions, something similar to IsByRef: was the parameter passed/omitted
- perhaps variadic functions where all parameters are ByRef
- perhaps a way to delete keys during a for loop, perhaps a reverse loop
- return intercept: an option to intercept 'return', so, each time a 'return' line is about to be executed, a function is executed before the return occurs
- RegExMatchAll: people keep being surprised that there is no way to do RegExMatch and retrieve all results (at least a prototype custom function could be developed for the documentation)
- support for `s in hotstrings in AHK v2
- obj := new %class%, perhaps a blank or other string to create a built-in array
- perhaps (a mode within a directive to) allow 'try global A_XXX := 1' and 'try A_XXX := 1' lines to be present in a script without causing an error
- allow lines of the form 'comma + control flow statement' in AHK v1/v2, as the move to functions in AHK v2 already makes possible multiple lines started by commas, and to avoid unnecessary curly braces, and to quickly add lines to code without needing to add curly braces

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

- Progress/SplashImage/SplashTextXXX/ToolTip - support negative delay values, to make it possible for the GUI window to timeout (disappear, without using Sleep and using the command a second time, and without using SetTimer).
- A DoNothing function or a suggested alternative perhaps Sleep(0).

- Also:
[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



- A_AhkDir, A_AhkName
- 'A_XXXNoExt': A_AhkNameNoExt, A_LoopFileNameNoExt, A_ScriptNameNoExt
- A_CoordModeControl
- A_DlgTitle(/A_GuiTitle/A_DefaultTitle) (keep A_ScriptName read-only)
- A_ScriptPID
- 'A_LoopFileXXX': A_LoopFileAttribNum (or A_LoopFileAttribValue), A_LoopFileNameNoExt, A_LoopFileTimeCreatedUTC/A_LoopFileTimeModifiedUTC (and A_LoopFileTimeAccessedUTC)

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

- DateAdd: add a Format parameter
e.g. DateAdd(DateTime, Time, TimeUnits, Format:="yyyyMMddHHmmss")
- [bonus] DateAdd: allow add months (e.g. + 3 months: 31 Jan -> '31 Apr' -> 30 Apr)

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

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

- 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' [EDIT: actually no, just 'Static' is needed, equivalent to 'Text']
GUI - Complete Command & Property Listing - AutoHotkey Community
- [bonus] GUI objects: increased support for setting the colour of a control (add it for more control types)
- [bonus] ControlGetLine: if line number omitted/blank, return text of current line

- Between: e.g. Between(vNum, vLim1, vLim2) [users are creating custom Between functions that are incompatible]
- Ceil/Floor: a Places parameter consistent with Round
- if (var is type): two-way compatible if within parentheses [and/or an IsNum/IsNumeric/IsType/StrIsType function]
- Pow function: subtle but useful, such code is easier to convert to/from other programming languages cf. a ** b, and it is useful for function libraries (I would use Pow instead of ** for function libraries but not necessarily for scripts)
- [bonus] Sign function: is number positive/0/negative (return 1/0/-1)
- [bonus] Log: a base parameter (cf. Excel's LOG function)

- RegCreateKey

- [bonus] Send: combine Send/ControlSend AHK v2 functions [or: optional control/window parameters for Send]
- [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)
file get part (SplitPath alternative/short-form/long-form/correct case) - AutoHotkey Community
- [bonus] StrCount
- [bonus] StrJoinReverse

- ControlGetFocusHwnd
- ProcessIs64Bit
- WinGetOwnerHwnd, WinSetOwnerHwnd
- WinGetParentHwnd, WinSetParentHwnd
- 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
swap bytes - AutoHotkey Community

- #SuspendExempt
- A_AllowMainWindow, A_IconHidden, A_IconTip
- A_InitialWorkingDir
- DateAdd/DateDiff (EnvAdd/EnvSub and +=/-= are confusing to use, even for experts)
- DirExist (simple, but very useful, counterpart of FileExist)
- FileInstall
- (writable 'A_' variables)



>>> StrRept [also mentioned by other people]
- repeat a string n times
- useful by itself, and for example, in combination with the Format function
- also functions such as Format, SendInput and RegExMatch/RegExReplace already have elements of 'repeat' functionality, this would increase consistency
- StrRept(vText, vNum)

>>> StrCount
- count occurrences of a needle string in a haystack string
- note: StrReplace can do this but not as the direct output of a function, also, it cannot specify case-insensitive/case-sensitive
- StrCount can be very useful in many situations, e.g. a quick if condition, that requires that a string appears an exact/minimum/maximum number of times
- StrCount(vText, vNeedle, vCaseSen:=0)
- or: StrCount(vText, vNeedle, vOpt)

>>> StrJoin/StrJoinReverse [also mentioned by other people]
- concatenate strings/an array's values
- this function would be essentially the reverse of StrSplit
- the pad parameter could accept a string or array
- StrJoin(vPad, oArray*)
- an example function with clever pad-character handling:
StrUnused prototype function: find unused characters for use as delimiters/separators - AutoHotkey Community

>>> StrUnused
- find characters not present in a string(/array of strings) that can be used as delimiters/separators
- this could be very useful e.g. where code needed to find unused characters can bloat an otherwise simple script/function
- this should handle linear arrays (possibly associative arrays)
- note: perhaps a built-in function could optimise checking for unused characters within array values
- vUnusedChars := StrUnused(vCount, oArray*)
- See:
StrUnused prototype function: find unused characters for use as delimiters/separators - AutoHotkey Community

>>> Sort
- new functionality:
- stable: (e.g. an A_SortStable variable) [an unstable sort can reorder items that are considered equal (arguably this breaks the principle of least astonishment), a stable sort maintains the order of items that are considered equal]
- reverse item order without sorting: (or a 'null sort'/'no sort' combined with the current reverse option) [at the moment Sort, with the reverse option, also does a text/numeric sort] [alternatively a StrJoinReverse function]
- specify no delimiter: alphabetise/randomise/reverse a string [note: alphabetise requires stable sort, reverse requires null sort]
- the ability to sort the values in a linear array as you would a character-delimited string
- note: an example of a stable sort: when you alphabetise a string, the capital letters will stay to the left of their lowercase equivalents (e.g. 'America' to 'Aaceimr' not 'aAceimr')
- syntax possibilities (can be something else):
X: null sort
XD: no delimiter
B0/L0/S0/T0, B1/L1/S1/T1: sort stable, e.g. B1 sort stable, B0 sort unstable
- examples:
e.g. 'X R' (reverse list without sorting) [alternative: StrSplit + 'StrJoinReverse']
e.g. 'XD B1' (alphabetise string) [alternative: RegExReplace with 'StrUnused' + 'Sort stable' + StrReplace]
e.g. 'XD Random' (randomise string) [alternative: RegExReplace with 'StrUnused' + Sort (random) + StrReplace]
e.g. 'XD X R' (reverse string) [alternative: StrSplit + 'StrJoinReverse']
- I would understand if the following wasn't implemented, because the Sort command doesn't currently support certain options for duplicate handling:
e.g. 'X U B1' (remove duplicates without sorting, keep earlier item where duplicates exist)
- other ideas might be: StrAlphabetize/StrRandomize/StrReverse functions
- I have a prototype function here:
Sort function + extra features - AutoHotkey Community

>>> binary data to/from hex strings (via StrGet/StrPut or HexGet/HexPut)
- StrGet/StrPut to handle hex (big endian/little endian)
- otherwise separate HexGet/HexPut functions
- this is quite a common task, converting a hex string to/from binary data
- it also compensates for the fact that NumGet/NumPut only handle little endian, and sizes of 1/2/4/8 bytes
- and similar functionality for base64
- a prototype function:
StrPut/StrGet + hex/base64 - AutoHotkey Community

>>> RegExMatch/RegExReplace: 'ANSI mode'
- recreate how RegExMatch/RegExReplace in ANSI versions of AutoHotkey
- perhaps a letter in the options cf. 's' for dotall
- otherwise perhaps separate 'RegExMatchA'/'RegExReplaceA' functions
- for binary/ANSI/UTF-8 searches within Unicode versions of AutoHotkey
- in general, AutoHotkey could do with better support for binary searches

>>> StrMatch [ideas of this kind also mentioned by other people]
- it would be a Swiss army knife-style super-function
- also StrContains and StrExact, to replace/exist alongside the contains/in operators
- and possibly StrStarts/StrEnds functions
- one use is as a faster alternative to RegExMatch, for: ^exact$/contains/^starts/ends$, that can handle literal text easily by specifying a delimiter character
- an options parameter could be added to specify delimiter character(/string)/case sensitive etc
- a compare option: would return a value based on comparing the needle string/array to the haystack: e.g. to establish the bigger/smaller of two variables, with options e.g. case sensitive/numeric, cf. using StringCaseSense and 'a<b', StringCaseSense is always best avoided when writing functions/code, cf. having to hardcode "" or +0 to force string/numeric comparison
- See:
Improve InStr or IfInString - AutoHotkey Community
- JEE_StrMatch(vHaystack, vNeedle, vOpt:="")
- with no options specified, equivalent to (vHaystack = vNeedle) or (vHaystack == vNeedle) depending on StringCaseSense
- some options (this is subject to review/expansion):

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

>>> ObjGetVals
- get specific keys/values from an array
- See here for a prototype function:
object get keys/values prototype function - AutoHotkey Community

>>> 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 pursuing. I am not adamant about the exact functionality or names that they should have, but I believe that I have suggested some good blueprints, with the majority of the key functionality.
- If people are too shy/reluctant to create powerful built-in functions such as these keys, it is worth considering any simpler functions that can be added to facilitate writing the super-functions, so that they can be shared on the forum as short readable custom functions. E.g. being able to do 'a op b', where you can specify op dynamically.



>>> SetAhkV2Mode function/directive (make AHK v1 more like AHK v2)
- a function and/or directive
- one mode, or granular settings, on/off, to make certain things function in AHK v1 more like they do in AHK v2
- Loop: use expression style parameters
- double quotes: disallow "" but do allow `"
- InStr/SubStr/RegExMatch/RegExReplace: handle negative values for positions as in AHK v2
- RegExMatch: in AHK v2: object mode is the default, and the line break handling has changed
- A_OSVersion: always return a number, not a friendly name

>>> Deref function
- possible granular options:
- specify a dereference character other than of %
- if a variable is blank, check for an environment variable
- for each variable, check for an environment variable first, if blank then check for a normal variable
- note: could treat %% as a literal %
- note: there is Transform-Deref in AHK v1, and there was Deref in AHK v2 alpha at one point
- usage example: to dereference '%MyVar%\MyFile.txt' retrieved from an ini file/selected text
- see:
AHK v2 and strings - AutoHotkey Community

>>> Verbatim 'command' (a one-line continuation section)
- similar to var = value in AHK v1
- command-style parameters, followed by a nonstandard special parameter
- an Options parameter, with a wide range of special options
- e.g. Verbatim,, vTarget, notepad.exe "C:\MyDir\MyFile.txt"
- e.g. Verbatim, vOpt, vTarget, "%vPathExe%" "%vPath%"
- similar to vTarget = "%vPathExe%" "%vPath%"
- it could handle text with both single/double quotes
- also, for var := '"C:\My Dir"', the single/double quotes can blur into each other
- could have special options like the Deref function
- there are further details here:
AHK v2 and strings - AutoHotkey Community

>>> continuation sections
- new functionality (to also apply to the Verbatim 'command'):
- a consistent mode in AHK v1/v2 where a literal double quote means a double quote (also worth considering, consistent handling of `" and `s)
- note: in AHK v1 all characters in a continuation section can be WYSIWYG except for double quotes

>>> bring over useful functions from AHK v2
- DateAdd/DateDiff (EnvAdd/EnvSub and +=/-= are confusing to use, even for experts) (possibly bring over the FormatTime function also)
- also: DateAdd could have a Format parameter like FormatTime does:
DateAdd(DateTime, Time, TimeUnits, Format:="yyyyMMddHHmmss")
- DirExist (simple, but very useful, counterpart of FileExist)
- FileInstall function (can't(/can't easily) be recreated as a custom function)
- Note: for reference: other key new AHK v2 functions: CallbackCreate/CallbackFree, CaretGetPos, RegDeleteKey, TraySetIcon, Type, WinGetClientPos. See:
list of every command/function/variable from across all versions - AutoHotkey Community

>>> conversion obstacles
- ControlClick/ControlGetPos/ControlMove: a Window to Client function is needed unless something like A_CoordModeControl is introduced (AHK v1 uses Window coordinates, AHK v2 uses Client coordinates).
- PixelGetColor/PixelSearch: an RGB to BGR function is needed unless a 'BGR' option is added to these functions. The AHK v1 commands have both RGB and BGR options. Otherwise some newbie-unfriendly bitwise logic and string formatting would be required.
- Progress/SplashImage: if these are expected to become 'semi-standard' custom functions, then it makes them harder for newbies to use, and would involve including massive custom functions in scripts shared on the forum. There may be additional disadvantages that I will explore when I try to recreate these as custom functions. One issue is that AHK does not let you specify the class name e.g. 'AutoHotkey2', e.g. some custom functions I use depend on the fact that the class is not 'AutoHotkeyGUI'.
- if var is type: 'type' now expects a variable, not hardcoded text, AHK v1 could allow double quotes to be used to simplify the transition, or even further, the parameter could be 'smart' in AHK v1: alpha / %MyVar% [maintain current behaviour], "alpha" [treat as string, ignore the double quotes], MyVar [not a valid option, treat as variable].
- ... Another idea re. if var in/contains/is type, is that when the AHK v2 behaviour is decided upon, it could be made available by the use of parentheses in AHK v1: e.g. if (var in list) cf. if var in list.
- #If WinActive(): if this was optimised in AHK v1, then #IfWinActive could be deprecated in AHK v1.

>>> conversion obstacles (further): backport features to make AHK v1 and AHK v2 more consistent
- A_InitialWorkingDir: one reason is that there could be issues relating to #Warn where in one version of AHK, the variable is built-in, and in one version it's not.
- A_AllowMainWindow/A_IconHidden/A_IconTip: currently these work quite differently in AHK v1/AHK v2 (in AHK v1, the Menu command is required).
- #SuspendExempt.
- Loop: One possibility would be to have LoopFiles/LoopParse/LoopRead/LoopReg in AHK v2, and when finalised, bring them to AHK v1. These names wouldn't clash with any existing control flow statement names, so backporting would be straightforward.
- ... This would leave Loop Count, the Count parameter could be treated as 'can be an expression', whenever Loop is used in AHK v1 with exactly one parameter.
- ... For the time being, all 5 Loop 'subcommands' in AHK v2 could support '% ' to force an expression, until AHK v2's final release, to allow for quick code testing between AHK v1 and AHK v2.



>>> redefine a function, but maintain access to the original
- a way to modify a function e.g. InStr/SubStr/RegExMatch/RegExReplace while having access to the original function e.g. to be able to recreate AHK v2 style behaviour in AHK v1 (otherwise certain changes/customisations/custom backporting can only be made/done via the source code)
- e.g. this can be useful for recording/warning when certain functions are used, it can also be useful when writing custom backports of built-in functions

>>> 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. this would make possible pointer to variable/object name
- 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 (or alternatively, a VarExist function)
- retrieving the line history, key history and hotkey list, direct to a variable, would also be useful
- more generally: access to the information stored by ListLines/ListVars/ListHotkeys/KeyHistory (the exact text and/or the same information retrievable via an object 'A_' variable)

>>> variables: list undeclared variables
- list any variables inside functions that are not declared as local or global
- in general, it's often more useful to retrieve start-up errors as a list, than as an unending sequence of MsgBoxes

>>> script parsers
- diagnostic scripts to parse AHK scripts
- e.g. for some selected code, identify the functions or the variables
- e.g. add special labels to a script marking where everything begins/ends e.g. var := Func(obj.key, var) -> [var starts]var[var ends][whitespace starts] [whitespace ends] etc
- e.g. a summary of each line with information about it e.g. var := Func(obj.key, var) -> assignment started/ended (var), function started/ended (Func)
- e.g. code to summary e.g. var := Func(obj.key, var) -> VVV PP FFFF(OOO.KKK, VVV) [note: 'P' for operator]
- e.g. existing scripts: DebugVars and ScriptInfo

>>> 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

>>> alias functions
- when defining functions, 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 (I am not particularly concerned about what the exact syntax would be):

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



>>> window criteria: ahk_dhw and ahk_mode [also mentioned by other people]
- this could drastically improve various functions/scripts that have to set/reset modes prior to a return
- e.g. if WinActive("Untitled ahk_class Notepad ahk_dhw H ahk_mode S")
- this would search for a hidden window, with a title that starts with 'Untitled'
- ahk_dhw: V/VH/H (visible/hidden/visible or hidden) (see DetectHiddenWindows)
- ahk_mode: S/C/X/R starts/contains/exact/RegEx (see SetTitleMatchMode)
- and 'E' for 'ends'
- some way of doing this has also been mentioned: ahk_xtitle (ahk_xclass etc) to exclude windows with certain properties
- note: it may make sense to add in case-sensitive/case-insensitive options (e.g. CS/CI), this is one of the few things in AutoHotkey that is always case-sensitive and thus causes confusion (perhaps case-insensitive should be the default)
- note: an extra reason for ahk_dhw and ahk_mode:
DetectHiddenWindows bug? - AutoHotkey Community

>>> FileGetBitness/ProcessGetBitness
- determine if a process is 64-bit/32-bit/16-bit
- e.g. retrieve information direct from the exe(/dll) file's contents
- 'FileGetBitness', and/or 'ProcessGetBitness', or the less powerful 'ProcessIs64Bit'
- otherwise possibly FileGetVersion improvements or a reasonably powerful FileGetInfo function

>>> #Include: further ideas
- #IncludeAtEnd: insert code at the end of the script, rather than at the current point in the script
- #IncludeIfArgContains: include a file if the nth command-line parameter contains a certain string
- /inc switch: include files via the command line
- #IncludeNoAuto (or #IncludePrevent/#IncludeBlock): prevent any files from being auto-included, all files would require an explicit include

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

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

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

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

var1 := 1, var2 := 2, var3 := 3
- also: it might be useful to be able to do an action, every time 'return' is called

>>> traditional for loop [also mentioned by other people]
- for loops are quite common in programming languages, and it's inconvenient that this is not easy to do in AutoHotkey
- they are also quite useful for certain loops relating to mathematics and to creating graphs (and for using NumGet/NumPut and SubStr at fixed interval offsets such as every 4th byte/character)
- this would be a good solution, if this class or similar was added to AutoHotkey e.g. for i in list.new(5, 12) (a name other than 'list')
[traditional for loop via objects][for i = a to b (step c)]
For loop question - Ask for Help - AutoHotkey Community
- an alternative would be to add this in some form to the documentation
- see this link for workarounds:
traditional for loop: for i = a to b (step c) possibilities - AutoHotkey Community

>>> 'Could not close the previous instance of this script. Keep waiting?'
- make this error message less likely
- perhaps add a button to (try once more and then) force reload
- perhaps add a function that gives you more granular control over this: e.g. how many times to try before and after showing the MsgBox, how long to try between MsgBoxes
- it would be useful to shed more light on this error
- and another mysterious error ...

>>> sometimes all of the hotkeys stop working
- although the script keeps working as usual
- solutions could include:
- a function to reregister the 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)

>>> MsgBox/InputBox/ToolTip: specify font
- a function/'A_' variable that can specify an hFont and/or font name/size/weight for these functions
- or guidance to make it possible to edit the font name/size for the main window/InputBoxes by editing the AutoHotkey exe file (the file itself, or live, in the address space)
- I mention the main window font, because the GDI handles (including hFonts) for a script can be retrieved by other scripts, and can be applied by using WM_GETFONT and WM_SETFONT

>>> A_NowMSec/A_NowMSecUTC (or DateGet)
- because you cannot reliably do vDate := A_Now A_MSec
- in fact, you cannot reliably combine any date variables in this way, e.g. you could have a year/month mismatch at the end of the year
- another possibility would be to retrieve date information as an array via a 'DateGet' function, e.g. via the Winapi functions GetSystemTime/GetLocalTime, see:
A_ variables - AutoHotkey Community
- (note: to avoid issues to do with long numbers and losing accuracy the variable could be a string with the 2 parts separated by a space (cf. a 17-digit number))
- (note: it appears that the Winapi's GetTimeFormat function and hence AHK's FormatTime don't support milliseconds, and thus it would make sense for FormatTime to remain as it is and to not support milliseconds)
- (note: you could use A_NowMSec to get the date including milliseconds (17 digits) and then use FormatTime to format the YMD HMS part (14 digits) and then append the milliseconds part)


- It would be useful if comparisons could be done via functions and/or operators only, for quick code alterations/creation via copy and paste:

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

if (var = var1)
|| (var ~= var2)
|| (var contains var3) ;not currently possible
|| (var in var4) ;not currently possible
if StrExact(var, var1) ;not currently possible
|| RegExMatch(var, var2)
|| StrContains(var, var3) ;not currently possible
|| StrExact(var, var4) ;not currently possible
- Also, if possible, custom binary operators would be another idea, e.g. a Op("MyOp") b, a Op(vOp) b, and/or a finite number of built-in operators that could be redefined.
- I see no particular reason for 'between' (AHK v1 only)/'contains'/'in'/'is type' to be operators, and not also standard functions: e.g. Between, Contains/StrContains, In/StrExact, IsType/StrIsType.
- For 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.

A_ variables - AutoHotkey Community
- A_Comma, A_DQ: since AHK v2 moves to using function syntax as the norm, and since functions use a lot of commas and double quotes (and single quotes in AHK v2), then 'A_' variables might be useful for clarity in some situations, also, A_DQ might be preferable to Chr(34) or """" or "`"" or '"' [e.g. A_Comma, A_DQ(/A_DQuote), A_LP(/A_LParen), A_RP(/A_RParen), A_SQ(/A_SQuote).]
- A_Recent/A_RecentItems: path of the Recent folder, i.e. My Recent Documents/Recent Items
- A_ScriptPID: the script's PID (useful generally e.g. for doing one-liners rather than two-liners, and more so if you do a lot of dll injection in remote threads, plus if you want to store the script's PID as a static variable in multiple functions)
- A_ThisHotkeyHwnd: the matching (e.g. active) window at the time the hotkey was triggered
- A_EditFunc/OnEdit: specify the name of a function to use instead (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]
- tray icons: specify hIcons for the 4 icons: Pause on/off, Suspend on/off (e.g. A_IconFile (already exists), A_IconFileP, A_IconFileS, A_IconFilePS)
- a way to make A_OSVersion work in AHK v1 as it does in AHK v2 (always numeric)
- maybe: A_Sp (v. A_Space), A_Field (v. A_LoopField) (in addition to the existing variables)
- A_WA(/A_AW) and A_CharWidth(/A_CharSize), W or A, 2 or 1, depending on whether the script is Unicode/ANSI, these would be widely used [also, something like A_Bitness to give 64/32, otherwise 64/86, might be useful for use with #Include, alternatively something like A_Extra1, A_Extra2, variables that could be set with something like a #Set directive based on a condition]

- Further suggestions mentioned in the link:
- A_CoordModeControl
- A_MouseSwapMode(/A_MouseButtonsSwapped/A_MouseButtonSwap/A_MouseSwapButtons)
- A_AhkDir, A_AhkName, A_AhkNameNoExt, A_LoopFileNameNoExt, A_ScriptNameNoExt (to #Include option files for exes/scripts, to refer to a file consistently whether compiled or not)
- A_DlgTitle(/A_GuiTitle/A_DefaultTitle) (i.e. keep A_ScriptName as read-only)
- A_SortMode/A_SortStable (stable sort)
- A_NowMSec/A_NowMSecUTC (or a DateGet function, that puts multiple variables into an object)
- A_LoopFileAttribNum/A_LoopFileAttribValue (or another name) cf. A_LoopFileAttrib [also: A_LoopFileNameNoExt, A_LoopFileTimeModifiedUTC]
- A_ThisHotkeyRaw (hotkeys consistently with/without the leading *~$) (could also apply to hotstring, to strip the leading ::/:*: etc)

- ControlGetFocusHwnd: to return an hWnd for the focused control, cf. ControlGetFocus which returns a ClassNN [also: ControlGetClassNN cf. ControlGetHwnd]
- delay: a general delay between line executions that can be turned on and off, e.g. Run Sleep Run Sleep
- delay: Send/SendInput and Sleep: the ability to do something like: SendInput, a{Sleep 100}b
- for loop: a symbol, that if used for the key, prevents a variable being created for it: e.g. for ~, vValue in oArray
- GUI: increased support for setting the colour of a control (add it for more control types)
- GUI: take over a GUI window created via DllCall (e.g. create a window and specify the class name and no icon) (perhaps GuiFromHwnd could to this for a hWnd that belongs to the process)
- 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)
- hotstrings: special hotkeys: define a hotkey/hotstring the same way you would define a Send line
- integers: dec to bin/bin to dec: functions to convert numbers to/from binary (0s and 1s)
- MemCopy/NumCopy/BinCopy: copy binary data from one location to another (a newbie-friendly wrapper for RtlMoveMemory/memmove)
- panic button: support to help stop a script, start/stop a hotkey subroutine (with the same hotkey/with different hotkeys)
- ProcessGetPriority function: get a process's priority, to be consistent with ProcessSetPriority
- ProcessIsAdmin function: is a window Admin? (administrator mode)
- RegCreateKey function: to be consistent with RegDeleteKey, cf. RegWrite, to create a key without also creating a blank default value in that key
- Send: allow {Event}/{Input}/{Play} as options and bring in Control, WinTitle etc parameters
- SubStr: a blank Length parameter to mean infinity (equivalent to omitting the parameter)
- WinGet: ProcessName/ProcessPath: get name/path with an option to retrieve the correct case
- WinGetOwner/WinSetOwner, WinGetParent/WinSetParent: this functionality is relatively common, and it would help newbies if these were available as standard, rather than via DllCall

- Ceil/Floor: a decimal places(/power of 10) parameter, to make Ceil/Floor consistent with Round
Ceil(Number, Places)
Floor(Number, Places)
- DateAdd: a 'Format' parameter cf. FormatTime [in every custom date function I use that returns a date, I make yyyyMMddHHmmss the default format, but I allow it to be changed]
DateAdd(DateTime, Time, TimeUnits, Format:="yyyyMMddHHmmss")
- FileGetShortcut: a ShortcutKey parameter, get the shortcut's shortcut key, to be consistent with FileCreateShortcut which can set this
FileCreateShortcut(Target, LinkFile, WorkingDir, Args, Description, IconFile, ShortcutKey, IconNumber, RunState)
FileGetShortcut(LinkFile, OutTarget, OutDir, OutArgs, OutDescription, OutIcon, OutIconNum, OutRunState, OutShortcutKey)
- StrReplace: a case-sensitive parameter (or an options parameter, or make Limit into an options parameter) (a workaround around is to use RegExReplace)
StrReplace(Haystack, SearchText, ReplaceText, OutputVarCount, Limit := -1, CaseSensitive := 0)
StrReplace(Haystack, SearchText, ReplaceText, OutputVarCount, Options := -1)

- '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
- FileSetText function (and/or 'FileEmpty'/'FileGetEncoding' functions)
- 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
- functions: a function that is created at start-up, but that is assigned a name such as SuggestedName0001/Untitled0001/Unnamed0001 by the script
- 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)
- 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)
- GUI: create a control by specifying 'Static' rather than 'Text' or 'Picture', this always catches me out
- InStrRev function: like InStr but that would search in reverse and accept positive values for positions
- integers: 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)
- 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]
- StatusBarGetText: option to specify a control other than 'msctls_statusbar321'
- StrReplace: perhaps allow StrReplace's SearchText parameter to accept an object, in order to replace multiple strings with one string

[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.



- assume local: cf. assume global, the word local by itself in the function would mean that all non-parameter variables not declared as global are assumed local [KEY: this is probably the most important idea on this list.]
- #Include: support more 'A_' variables (A_Desktop, A_AhkPath, A_UserName, possibly 'A_Args##') [KEY: users can't implement this]
- file loop: handle long paths (when listing files/backing up files etc, there's no particular reason to omit files/subfolders with long paths) [otherwise users could unexpectedly fail to back up/copy files/folders]

>>> #Include: support more 'A_' variables [also mentioned by other people]
- support: A_Desktop, A_AhkPath, A_UserName, possibly 'A_Args##'
- A_AhkPath could be especially useful, as each exe in a folder could have its own folder or files e.g. 'AutoHotkeyU64 Lib' or 'AutoHotkeyU64'
- a lot of things 'can' be done with the #Include directive, but are unnecessarily and sometimes fiendishly complicated to do, and not newbie-friendly
[IMPLEMENTED AS: 'Added support for all built-in variables in #Include.' 'All built-in variables are valid, except for ErrorLevel, A_Args and the numbered variables.']

>>> Hotstring function
- a function to create hotstrings dynamically cf. the Hotkey command

- A_Args
- A_ComSpec

When loops are finalised in AHK v2:
- A_LoopFilePath

- A_TimeIdlePhysical: option to ignore mouse movements, i.e. the value is not reset to 0 by mouse movements
[IMPLEMENTED AS: A_TimeIdleKeyboard and A_TimeIdleMouse.]

- Min/Max functions: get the smallest/biggest number in a list: Min(a,b) cf. (a<b?a:b)
- hotstrings with colons: make all hotstrings possible, at present, some hotstrings containing colons can't be created (perhaps some way to escape colons for hotstrings)
- WinWait/WinWaitActive functions in AHK v2: return an hWnd.




>>> objects: count keys [also mentioned by other people]
- count all of the keys within an object (i.e. with numeric or string names)
- e.g. an 'ObjCount' function, possibly an obj.Count() method
- or an additional parameter added to ObjLength
- e.g. when listing the keys/values in an object, ObjCount could help you prepare a large enough variable
- also, perhaps an obj.Len() method could be added to standard arrays cf. obj.Length()

>>> file loop: handle long paths
- allow file loops to handle long paths (perhaps by specifying the '\\?\' prefix, or having an 'L' option cf. 'FDR')
- when backing up/moving files/getting file info/trying to list files with long filenames, there is no reason why long filenames (and long folder names) should be excluded from the results
- arguably the current behaviour is newbie-unfriendly and breaks the principle of least astonishment
- note: long name support was added for AHK's registry loops (v1.0.48 - February 25, 2009)



- note: for AHK v1, AHK v2, or both
- Changed a-z to mean vk41-vk5A when absent from the keyboard layout, except with Raw mode or when sending single unmodified characters. This allows hotkeys and sent keyboard shortcuts to work more intuitively on certain non-English keyboard layouts.
- Added {Text} mode for Send and T option for hotstrings. These are like the Raw mode, but more reliable.
- Replaced A_CaretX/Y with CaretGetPos(x, y).
- [AHK v2] Changed bitwise-NOT (~) to always treat number as 64-bit.
- [AHK v2] Changed string->integer conversion to allow overflow consistent with arithmetic operations. ... now true: ... 0xFFFFFFFFFFFFFFFF == -1
- Added A_ListLines.
- Added hotstring E option to execute instead of auto-replace. [it's now X]
- Changed WinMenuSelectItem to treat menu 0& as the window's system menu.
- Added MaxParts parameter to StrSplit.
- Added WinGetClientPos.
- Added Hotstring("Reset") for manually resetting the hotstring recognizer.
- Fixed Control ChooseString to send WM_COMMAND even if the control's ID is 0. [e.g. to notify Notepad's Save As dialog]
- Added ObjGetBase(Obj) and ObjSetBase(Obj, BaseObj).
- Added ObjRawGet(Obj, Key).

Last edited by jeeswg on 05 Aug 2018, 20:18, edited 227 times in total.
User avatar
Posts: 2318
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] [Download] GeSHi © Codebox Plus

var1 := 1, var2 := 2, var3 := 3, return

would be converted by AHK to:

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

var1 := 1, var2 := 2, var3 := 3

This one works:

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 1803) x64 | [GitHub] Profile
Donations are appreciated if I could help you
just me
Posts: 5431
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: 3094
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: 5431
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: 4782
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] [Expand] [Download] GeSHi © Codebox Plus

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] [Download] GeSHi © Codebox Plus

;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()
User avatar
Posts: 311
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: 4782
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] [Expand] [Download] GeSHi © Codebox Plus


[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

[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
User avatar
Posts: 4782
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
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] [Expand] [Download] GeSHi © Codebox Plus


[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] [Expand] [Download] GeSHi © Codebox Plus

Posts: 3094
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: 3094
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: 4782
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] [Download] GeSHi © Codebox Plus

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


- 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] [Download] GeSHi © Codebox Plus

vIsV1 := !!InStr(1,1,1,0)
vPos := InStr(vText, vNeedle, 0, vIsV1-1)

Also things like RegExMatch with $ are workarounds.
- SubStr:

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

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] [Download] GeSHi © Codebox Plus

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

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.
User avatar
Posts: 3062
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: 4782
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.
User avatar
Posts: 4782
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.
User avatar
Posts: 4782
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.
User avatar
Posts: 4782
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] [Expand] [Download] GeSHi © Codebox Plus

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 3 guests