Winmove error with "[" in window title

Get help with using AutoHotkey and its commands and hotkeys
joefiesta
Posts: 455
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Winmove error with "[" in window title

05 Dec 2017, 14:16

The following code produces an error. Specifically "Missing [".

Code: Select all

winmove, KEDIT - [, , 15, 43, 1316, 954
I can't find anything in the WinMove documentation https://www.autohotkey.com/docs/commands/WinMove.htm
that leads me to believe my code is incorrect. There is also nothing a the documentation for a "Window Title" about this. That is at: https://www.autohotkey.com/docs/misc/WinTitle.htm

The title of the window is "KEDIT - [C: ..."

Is the documentation missing something or is my code incorrect?
User avatar
davebrny
Posts: 84
Joined: 05 Dec 2016, 06:26

Re: Winmove error with "[" in window title

05 Dec 2017, 15:15

how about this?

Code: Select all

winmove, % "KEDIT - [", , 15, 43, 1316, 954
BoBo
Posts: 6503
Joined: 13 May 2014, 17:15

Re: Winmove error with "[" in window title

05 Dec 2017, 15:23

Quite often you'll find the solution if looking at "related" commands > SetTitleMatchMode > RegEx
OR you change the windows title to your liking before further processing > WinSetTitle
joefiesta
Posts: 455
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Winmove error with "[" in window title

05 Dec 2017, 15:24

Thank you "davebrny", but, I am looking for the answer to my question, not a workaround. My question, again, being: Is the documentation missing something or is my code incorrect?
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Winmove error with "[" in window title

05 Dec 2017, 18:03

WinMove has two forms:
WinMove, X, Y
WinMove, WinTitle, WinText, X, Y [, Width, Height, ExcludeTitle, ExcludeText]
For the first form, the documentation says that X can be an expression and, from the "Expressions" section of the documentation:
[v1.0.97+]: Array literal. If the open-bracket is not preceded by a value (or a sub-expression which yields a value), it is interpreted as the beginning of an array literal. For example, [a, b, c] is equivalent to Array(a, b, c) (a, b and c are variables).
That's my guess as to what's going on, that it thinks that you're using the first form because you appear to be defining an array, but you're not finishing that definition. Such a WinTitle probably works with most other Win* commands, but not WinMove unless you use expression form (as davebrny used).
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Winmove error with "[" in window title

05 Dec 2017, 19:05

As Osprey alluded to, it looks like a parsing error by AutoHotkey, you used the parameter correctly, but AutoHotkey misinterpreted it.

If you'd added a closing square bracket and typed this:
winmove, KEDIT - [, , 15, 43, 1316, 954]
That would mean that you'd specified one parameter, equivalent to:
WinMove, X
Or at least, it could potentially mean that, if WinMove uses 'can be an expression' mode when there are 1 or 2 parameters.

I too received this error:
Error: Missing "]"
And this fix worked:
winmove, % "KEDIT - [", , 15, 43, 1316, 954

This would be a good post for Bug Reports perhaps.
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 “Ask For Help”

Who is online

Users browsing this forum: AlexOfRhodes, Bing [Bot], Descolada, fellipeao, Google [Bot], humanbean, joedf, quentin, Spawnova, tatagi and 58 guests