@just me:
Parameters that are documented as 'can be an expression' directly support expressions, but in an unusual way. Without the '% ' such parameters should continue to act in that unusual way, but with the '% ' which is used to 'force an expression', it should indeed 'force an expression'.
@all:
I started this thread to document the problem, whether it is resolved or not, it affects script writing and conversion, and also in my case, the writing of a beginner tutorial.
Clearly it would be better if 'force an expression' would always mean that the parameters behaved just like they did in an expression, this is what most users would expect, and so far I have seen nothing in the documentation which explains that 'force an expression' is currently inconsistent and can't be relied upon (to make a parameter behave just like it would in an expression).
Here are two attempts at listing which commands/parameters are affected:
Command syntax - "This parameter can be an expression" - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 418#p41418
[EDIT: this file no longer exists, it was split into separate AHK v1/v2 files:]
Scintillua-ahk/ahk.lua at master · Lexikos/Scintillua-ahk · GitHub
https://github.com/Lexikos/Scintillua-a ... k.lua#L818
[EDIT: see here instead:]
GitHub - Lexikos/Scintillua-ahk: AutoHotkey lexers for Scintillua + SciTE4AutoHotkey
https://github.com/Lexikos/Scintillua-ahk
When you 'force an expression' by prefixing a command parameter with '% ', you expect it to act like an expression.
Code: Select all
;current situation: these are equivalent:
PostMessage, a, b, c, Edit1, A
PostMessage, %a%, % %b%, % %c%, Edit1, A
PostMessage, % %a%, % %b%, % %c%, Edit1, A ;old behaviour: 'can be an expression' takes precedence over 'force an expression'
PostMessage(a, b, c, "Edit1", "A")
;it should be that these are equivalent:
PostMessage, (%a%), (%b%), (%c%), Edit1, A
PostMessage, % (%a%), % (%b%), % (%c%), Edit1, A
PostMessage, % %a%, % %b%, % %c%, Edit1, A ;new behaviour: 'force an expression' takes precedence over 'can be an expression'
PostMessage(%a%, %b%, %c%, "Edit1", "A")
Did anyone seriously expect that 'can be an expression' would take precedence over 'force an expression'?
Btw using the information from the link and by searching the help file for 'can be an expression' and 'can be expressions', I can greatly improve my script converters.