Calling gnucash from the command line

Vincent Laisney vincent.laisney@gmx.net
Mon, 14 Jan 2002 11:50:19 +0100


On Thursday 01 January 1970 00:59, Sonja Krause-Harder wrote:
> vel-admin@lists.gnumatic.com
> Errors-To: gnucash-devel-admin@lists.gnumatic.com
> X-BeenThere: gnucash-devel@lists.gnumatic.com
> X-Mailman-Version: 2.0.2
> Precedence: bulk
> List-Help: <mailto:gnucash-devel-request@lists.gnumatic.com?subject=help>
> List-Post: <mailto:gnucash-devel@lists.gnumatic.com>
> List-Subscribe:
> <http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel>,
> <mailto:gnucash-devel-request@lists.gnumatic.com?subject=subscribe>
> List-Id: Discussion of the gnucash personal finance program
> <gnucash-devel.lists.gnumatic.com> List-Unsubscribe:
> <http://www.gnumatic.com/cgi-bin/mailman/listinfo/gnucash-devel>,
> <mailto:gnucash-devel-request@lists.gnumatic.com?subject=unsubscribe>
> List-Archive: <http://www.gnumatic.com/pipermail/gnucash-devel/>
> Date: Sat, 12 Jan 2002 21:40:55 +0100
>
> Hi,
>
> I want to get data from a Palm OS handheld into GNUCash.
>
> I read the data from the Expenses application on the handheld
> with (a slightly modified version of) the read-expenses tool
>
> >from the pilot-link package, which works fine. I now want to
>
> hand that data over to GNUCash with a script. I've found out
> that I probably want to call gnucash with --evaluate.
> I'm a bit lost regarding the guile commands needed to add
> transactions into gnucash, though. I'm perusing the source right
> now, but maybe a kind soul could point me in the right direction.
>
> Thanks in advance,
>
> Sonja
>
> (As this might evolve into something more sophisticated later on:
> is there anyone else interested in/working on a gnucash companion
> for PalmOS?)
I have made a Hack with gnucash 1.4 to cancel the older transaction and 
replace them with a summary transaction of them. It worked well, but it was 
not beautiful. 
At the moment somebody had asked whether this tool already existed and since 
it did not I have done it for myself. If somebody had interess I can publish 
it (Where?).
>From this hack I extract the lines for adding one transaction (in scheme):

        (let ((split (gnc:split-create))
              (transaction (gnc:transaction-create)))
          (gnc:transaction-init transaction)
          (gnc:split-set-value split amount)
;         (gnc:split-set-memo split "A nouveau")
          (gnc:transaction-begin-edit transaction 0)
          (gnc:transaction-append-split transaction split)
          (gnc:transaction-set-description transaction "A nouveau")
          (gnc:transaction-set-date-time-pair transaction (cons 
(current-time) 0))
          (gnc:transaction-commit-edit transaction)
          (gnc:account-insert-split account split))))

I had looked at the function list form gnucash-dev documentation
Cheers
Vincent Laisney