[GNC] User-defined commands

john jralls at ceridwen.us
Tue Nov 29 12:58:55 EST 2022



> On Nov 29, 2022, at 4:40 AM, Helmut Eller <eller.helmut at gmail.com> wrote:
> 
> Is there some easy way to add user-defined commands to the menus?
> 
> I wrote some Scheme code for various tasks and currently I execute this
> code via custom reports as a side effect.  This works, but it would be
> nicer if I could create proper menu items for these commands.  Ideally,
> the command would be called with some arguments, e.g. the currently
> selected transaction.
> 
> Is this possible?  Is it documented somewhere?

Yes, it's possible. No, it's not documented.

See the definition of gnc:add-report-template-menu-item at https://github.com/Gnucash/gnucash/blob/maint/gnucash/gnome/report-menus.scm#L42 for example code. It's all specialized for report templates so you'll have to copy and modify a lot of code. Note the convention that functions starting with gnc: are written in Scheme and those starting with gnc- or xacc are written in C and exposed to Guile via SWIG.

Regards,
John Ralls



More information about the gnucash-user mailing list