Re: [Gimp-user] Gimp-user Digest, Vol 94, Issue 25

2010-07-25 Thread Kevin Cozens
Dillon wrote:
> Is that really a "must" ?  It turns out I was missing variable declarations,
> but I have never provided initial values when declaring variables in a let
> block, and that doesn't seem to cause issues.

Yes, it is a must unless you are using GIMP 2.4 or earlier. The TinyScheme 
component of GIMP more closely follows the Scheme standard. The standard 
requires variables in a lot block to have an initial value, and all 
variables must be declared before first use.

You should take a look at the Script-Fu migration guide at 
http://www.gimp.org/docs/script-fu-update.html and my notes at 
http://www.ve3syb.ca/wiki/doku.php?id=software:sf:updating-scripts (which 
cover most of the same points).

> I think that this line is not returning the number of layers as we're
> expecting.  I tried using gimp-message to write the number of layers out to
> the console, but it generates another batch execution error.
[snip]
> (gimp-message "The current file has the following number of layers: ")
> (gimp-message num-layers)

The problem with the above is you are passing an integer to gimp-message 
instead of passing a string. You need to wrap num-layers in a call to 
number->string.

You can combine the two calls to gimp-message so the number of layers 
appears in the message by doing the following:

(gimp-message
   (string-append
 "The current file has the following number of layers: "
 (number->string num-layers)))
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user


Re: [Gimp-user] Gimp-user Digest, Vol 94, Issue 25

2010-07-24 Thread Dillon
Is that really a "must" ?  It turns out I was missing variable declarations,
but I have never provided initial values when declaring variables in a let
block, and that doesn't seem to cause issues.

I'll experiment.

On Sat, Jul 24, 2010 at 9:39 AM,
wrote:

Message: 2
> Date: Sat, 24 Jul 2010 11:45:24 -0400
> From: Kevin Cozens 
> Subject: Re: [Gimp-user] Script-Fu for batch image conversion
> To: gimp-user 
> Message-ID: <4c4b0a94.7010...@ve3syb.ca>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Dillon wrote:
> > (set! num-layers (car (gimp-image-get-layers newimage)))
> > (set! layerIDs (cadr (gimp-image-get-layers newimage)))
>
> What error messages do you get when the above lines are included?
>
> > (define (batch-save-as-xcf pattern)
> >   (let* (
> >   (filelist (cadr (file-glob pattern 1)))
> >   (fileparts)
> >   (xcfname)
> >   (filename)
> >   (image)
> >   (newimage)
> >   (drawable)
> >   )
>
> The declarations for variables "fileparts" through to "drawable" are wrong.
> You must provide an initial value when defining a variable in a let block.
>
> The simple solution is to add a 0 or -1 to the declarations for numeric
> variables and "" string variables. Any value will work but it helps to
> stick to the a value similar to the type of value the variable could
> typically hold.
>
___
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user