[GNC] User-defined commands

Christopher Lam christopher.lck at gmail.com
Wed Nov 30 05:20:49 EST 2022


On Wed, 30 Nov 2022 at 15:55, Helmut Eller <eller.helmut at gmail.com> wrote:

    On Tue, Nov 29 2022, john wrote:
    > 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.

    Thank you.  With this I was able to add a command to the Tools
    menu. (See the attached file, in case somebody is interested.)


This is indeed interesting... I'd previously experimented with a repl
server[1], using nc to connect. Yours is much more elegant. Would you care
to add to the wiki?

[1]
https://wiki.gnucash.org/wiki/Custom_Reports#Command_line_access_to_the_API

With yours, one can launch via Tools > Scheme REPL, then (use-modules
(gnucash engine)) to import the whole engine api.


    Can the same strategy also be used to add items to the popup menu?

    I'm mostly asking if I should look harder or if it is not possible
    because there are no Scheme bindings for the popup menu.  Similarly, is
    there a Scheme binding for
    gnc_plugin_page_account_tree_get_current_account?


I don't think there is.


More information about the gnucash-user mailing list