for-each disappeared from Script-fu?
Hi,
I am trying to run a script I used with gimp 1.2 under the new Gimp 2.0 (which
I love, by the way), and it stops with the following error:
Error while executing
(script-fu-menu-items "/home/rabbit/hv/design/menu_items/"
"-b&h-lucida-medium-r-normal-*-*-140-*-*-p-*-iso8859-1" TRUE TRUE)
ERROR: unbound variable (errobj for-each)
The error message gives me the impression that the for-each construct is
somehow not supported anymore in Script-fu/scheme. Can anyone confirm this?
If so, what is the alternative?
I'm using Debian unstable on linux-x86.
Thanks in advance,
Frans
The function in which the error occurs (slightly trimmed) follows. I added the
"Here x" messages to try to narrow down the location of the error, but now I
get the following behavior:
1) error message
2) message "Here 2"
3) message "Here 1"
This order makes no sense to me at all. Can anyone shed some light on this?
(define (script-fu-menu-items path font normal hi)
(gimp-message "Here 1")
(let* (
(items (list
'("Home" "home_en" 0)
; ... and a whole lot more of these
))
(i 0)
)
(gimp-message "Here 2")
(for-each
(lambda (x)
(if (= normal TRUE)
(let ((img (script-fu-menu-item (car x) font FALSE (caddr x) FALSE)))
; save as (string-append path (cadr x) ".gif")
(file-gif-save 1 img (car (gimp-image-get-active-layer img))
(string-append path (cadr x) ".gif") (string-append (cadr x) ".gif") 0 0 0 0)
(gimp-image-delete img)
(set! i (+ i 1))
)
())
(if (= hi TRUE)
(let ((img (script-fu-menu-item (car x) font TRUE (caddr x) FALSE)))
; save as (string-append path (cadr x) "_hi.gif")
(file-gif-save 1 img (car (gimp-image-get-active-layer img))
(string-append path (cadr x) "_hi.gif") (string-append (cadr x) ".gif") 0 0 0
0)
(gimp-image-delete img)
(set! i (+ i 1))
)
())
)
items
)
(gimp-message "Here 3")
(gimp-message (string-append (number->string i) " menu items created and
saved to `" path "'."))
)
)