1

I am trying to set up a conditional statement in a Gimp Script-Fu script, and nothing appears to be executing.

(gimp-message "before cond")
(cond
    [#t (gimp-message "I should see this")]
    [else (gimp-message "I shouldn't see this")]
)
(gimp-message "after cond")

The output I'm getting is the following

script-fu.exe-Warning: before cond

script-fu.exe-Warning: after cond

What am I doing wrong here? Why are none of my gimp-messages showing up in the cond statement?

TJ Rockefeller
  • 3,178
  • 17
  • 43
  • Do you know that you can write the script in Python, which is somewhat more programmer-friendly? – xenoid May 10 '17 at 01:18
  • I am aware of that, but for now this is modifying an existing script-fu program. I've also heard that if you want to run the script purely from the console with no gui interaction you at least need a wrapper written in script-fu right? – TJ Rockefeller May 10 '17 at 13:10

1 Answers1

1

I think I got my syntax for cond from racket documentation since there isn't a lot of documentation for TinyScheme or more specifically Script-Fu

I found that the syntax recognized by Gimp is basically the same thing, but replacing the brackets [] with parentheses ()

(gimp-message "before cond")
(cond
    (#t (gimp-message "I should see this"))
    (else (gimp-message "I shouldn't see this"))
)
(gimp-message "after cond")

After replacing the brackets I got my expected output. It's frustrating that there was no error to say that the brackets were unexpected.

TJ Rockefeller
  • 3,178
  • 17
  • 43