Possible to add plugin entry to User Menu? With a condition?

Столкнулись с проблемой в использовании макросов? Здесь можно получить помощь.
Post Reply
SinusPi
Posts: 1
Joined: Mon 20 Jul, 2020 19:17

Possible to add plugin entry to User Menu? With a condition?

Post by SinusPi »

Извините, не говорю по-Русски достаточно чтобы говорить о плагинах... :P

Is it possible to add a Lua plugin entry to the F2 User Menu? Or, specifically, to have entries in that menu appear only on certain conditions? I'd like some different options for hitting F2 on a JPG, a PDF, a TXT, an EXE, or maybe on a name that matches a regexp... Or, is my only option to make my plugin show as a menu in the F11 Plugins menu, and - basing on the selected file name - open as a different submenu?
Shmuel
Posts: 6819
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 528 times

Possible to add plugin entry to User Menu? With a condition?

Post by Shmuel »

SinusPi wrote: Mon 20 Jul, 2020 19:27 Is it possible to add a Lua plugin entry to the F2 User Menu?
Not only Lua, you can add any plugin entry if it has a command line prefix.
For example: lua: far.Message 'Hello'
SinusPi wrote: Mon 20 Jul, 2020 19:27 Or, specifically, to have entries in that menu appear only on certain conditions?
No it is not possible.
SinusPi wrote: Mon 20 Jul, 2020 19:27 I'd like some different options for hitting F2 on a JPG, a PDF, a TXT, an EXE, or maybe on a name that matches a regexp...
1) It does not have to be in user menu. Write a macro that will analyze the name under cursor and do actions depending on that. This macro may be bound to any shortcut.
2) Another (and more conventional) approach - use Commands -> File Associations.
User avatar
citRiks
Posts: 1733
Joined: Fri 25 Oct, 2019 18:18
Has thanked: 610 times
Been thanked: 102 times

Possible to add plugin entry to User Menu? With a condition?

Post by citRiks »

Shmuel wrote: Mon 20 Jul, 2020 19:56 No it is not possible.
Is not it is possible thru Lua programming?
lets say, we catch open menu event, in that even programmatically adding or nor some menu items?
Agree that it is to complicated for occasional user not interested in to became Lua guru
User avatar
buniak_a_h
Posts: 4236
Joined: Sat 20 Apr, 2013 00:17
Location: Санкт-Петробад
Has thanked: 222 times
Been thanked: 643 times
Contact:

Possible to add plugin entry to User Menu? With a condition?

Post by buniak_a_h »

Shmuel wrote: Mon 20 Jul, 2020 19:56
SinusPi wrote: Mon 20 Jul, 2020 19:27 Or, specifically, to have entries in that menu appear only on certain conditions?
No it is not possible
See Here. Script makes menu item disabled if file «usermenu.ini» not found. If you replace LIF_DISABLE with LIF_HIDDEN, menu item not appear in menu. Sorry for my english …
Post Reply

Return to “Нужна помощь”