Re: [Gimp-user] Writing values to a file from within GIMP

2007-07-28 Thread saulgoode
> Hi,
>
> I'm writing a script-fu GIMP plugin and I need to be able to write some
> decimal values to a file during the execution of the script.  I've seen
> some
> people suggesting that use of fprintf, etc., but can't figure out how to
> get
> this to work.  Can someone please provide some guidance?

If you are using GIMP 2.3.14 or later, the following code should
demonstrate how to write to a file:

(define outport (open-output-file "samplefile.txt"))
(display  "Hello" outport)
(newline outport)
(display "World" outport)
(close-output-port outport)

If you are using a stable version (2.2.x) of the GIMP, then you will need
to use SIOD's 'fopen', 'fwrite', and 'fclose' functions.

(define outfile (fopen "samplefile.txt" "w"))
(fwrite "Hello" outfile)
(fwrite "\n" outfile)
(fwrite "World" outfile)
(fclose outfile)

___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Writing values to a file from within GIMP

2007-07-27 Thread David Gowers
On 7/28/07, David Feinzeig <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm writing a script-fu GIMP plugin and I need to be able to write some
> decimal values to a file during the execution of the script.  I've seen some
> people suggesting that use of fprintf, etc., but can't figure out how to get
> this to work.  Can someone please provide some guidance?
>
> Thanks!
> Dave
>
Hi,

fprintf() is a C function, and because it does I/O, it's unlikely to
be exposed to Script-Fu. Script-Fu cannot, for instance, delete files,
so I would expect it cannot directly create files either (only save
images using gimp-file-save.). I recommend you look up a reference for
the Script-Fu API. plug-ins/script-fu/tinyscheme/Manual.txt is the one
you probably want. It looks like Script-fu actually does support I/O.
(that file is in the SVN repository; it might also be in a
distribution tarball (eg. gimp-2.3.19.tar.bz2)
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


[Gimp-user] Writing values to a file from within GIMP

2007-07-27 Thread David Feinzeig
Hi,

I'm writing a script-fu GIMP plugin and I need to be able to write some
decimal values to a file during the execution of the script.  I've seen some
people suggesting that use of fprintf, etc., but can't figure out how to get
this to work.  Can someone please provide some guidance?

Thanks!
Dave
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user