Gimp-user Digest, Vol 94, Issue 25
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)))