[solved] Command "expression mode" mishandles direct arrays

Report problems with documented functionality
TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

[solved] Command "expression mode" mishandles direct arrays

27 Nov 2014, 17:38

Code: Select all

x:=2
MsgBox,,,% "Text " ["text1 ","Text2 "][x] "Text3"        ; bug - only shows Text3
MsgBox,,,% "Text " LTrim(["text1 ","Text2 "][x]) "Text3" ; shows Text Text2 Text3
z:=["text1 ","Text2 "]
MsgBox,,,% "Text " z[x] "Text3"                          ; shows Text Text2 Text3
The errant behaviour of the first MsgBox is also seen on other commands.

If a direct associative array {...} is attempted for the first MsgBox, an error is shown 'Unexpected {'.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
lexikos
Posts: 9690
Joined: 30 Sep 2013, 04:07
Contact:

Re: Command "expression mode" mishandles direct arrays

27 Nov 2014, 22:10

Your syntax is incorrect. You need to use explicit . concat in this case.
Concatenate. The period (dot) operator is used to combine two items into a single string (there must be at least one space on each side of the period). You may also omit the period to achieve the same result (except where ambiguous ...
TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Command "expression mode" mishandles direct arrays

27 Nov 2014, 23:23

Thanks
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 14 guests