Instructor
Please consider adding the 'commands chain' functionality to the ContextMenu plugin (and maybe to the Toolbar plugin as well), that would allow executing several commands in a sequence, one after another, within a single menu item call.
The syntax could be pretty simple: a comma-separated list of commands.
An example:
Добавлено: переменная %lb - позиция начала URL (работает только в "Меню ссылок"). Добавлено: переменная %le - позиция конца URL (работает только в "Меню ссылок").
Added: variable %lb - URL start position (work in "URL menu" only). Added: variable %le - URL end position (work in "URL menu" only).
Instructor wrote: ↑Tue Mar 31, 2026 11:06 pmAdded: variable %lb - URL start position (work in "URL menu" only). Added: variable %le - URL end position (work in "URL menu" only). ContextMenu plugin v18.4
Actually, it's also:
[r4536] by instructor_
Changed: reset %lb and %le variables after URL menu closing.
Well done. Thank you.
Now the URL selection logic works as intended, allowing a script to be called with the predictable results from any context menu:
Good to know. Thank you.
However, it turns out, it works waay too loong, and with rendering issues, so I will not recommend anyone using this approach (with the EvalCmd.js as a proxy) outside of testing purposes.
Calling this method directly from a user script is much faster, with immediate effect and comfortable rendering.
The syntax is not impressive, to say the least. And after trying it, I finally preferred to modify my scripts to do things internally, rather than chaining commands outside in the context menu/toolboard via EvalCmd.js.
Thank you anyway for the interesting information. It's been useful to know that it was possible in principle.
Instructor
Is it normal and intended by design that the %le variable defines the URL end position only within AEM_SETURLMAXLENGTH, but NOT the ACTUAL URL end, and therefore misses everything beyond AEM_SETURLMAXLENGTH?
It makes working with random long URLs a pain.
Of course, as a workaround, I can* redefine AEM_SETURLMAXLENGTH each time I call %lb,%le, but it would be overkill for most of the regular use cases.
It would be great if it were possible to do something with %le behavior in that regard (e.g., allowing %le to capture the URL structure to the last character without enforcing a hard SETURLMAXLENGTH limit first).
Edit:
* No, I can not. It turns out that it is impossible to do from a script that calls %lb,%le, because %le has already been assigned before the script gets a chance to redefine SETURLMAXLENGTH. It implies I have to redefine SETURLMAXLENGTH in a separate action first, and only then will it make sense to run the script in question. So this is even worse than I initially imagined.
Still, I've been processing such long URLs en masse outside of the %lb,%le URL menu couple without any issues, so there definitely should be a way.