[Gimp-user] batch mode debugging
saulgoode at flashingtwelve.brickfilms.com
saulgoode at flashingtwelve.brickfilms.com
Sun Sep 9 12:28:29 PDT 2007
Quoting Milos Prudek <prudek at bvx.cz>:
>> It is my understanding that ALL Script-fus are run non-interactively.
>
> script-fu-fuzzy-border can run interactively. It is available in
> Right-click/Script-Fu/Decor/ menu in GIMP. It asks interactively for its
> parameters. Is it an interactive run?
The dialogs for Script-fus are generated and handled by the GIMP.
Unlike plug-ins and other scripting languages, there is nothing that a
Script-fu script has to do to interact with the user -- the parameters
are defined by the dialogs before the 'script-fu-*' function is
evaluated. This is why the function is considered non-interactive.
>> not have the same 'drawable' ID as before the flattening. If you do a
>> second 'gimp-image-get-active layer' after flattening then you will be
>> passing the proper 'drawable' ID to the save plug-in.
>
> OK. I tried to implement your idea:
>
> (define (fuzzy-border-single filename)
> (let* ((image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
> (drawable (car (gimp-image-get-active-layer image))))
>
> (script-fu-fuzzy-border image drawable '(255 255
> 255) 120 TRUE 9 FALSE 0 FALSE TRUE)
> (set! (drawable (car (gimp-image-get-active-layer image))))
> (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
> (gimp-image-delete image)))
>
> But it outputs "batch command: experienced an execution error."
>
> I learned the basics of Scheme yesterday. Is this some kind of scope
> error? Am
> I changing a different "drawable" variable?
Sort of. You have a couple of unwanted parentheses in your 'set!'
statement and 'drawable' is being treated as a function. The
appropriate syntax would be:
(set! drawable (car (gimp-image-get-active-layer image)))
You're doing well for only your second day with Scheme. One thing that
might help you in debugging scripts is using the Script-fu console. If
you open the console ("Xtns->Script-fu->Script-fu Console") and
execute your command providing appropriate parameters:
(fuzzy-border-single "/home/milos/somefile.jpg")
then the error messages produced will be somewhat more useful than
"experienced an execution error".
More information about the Gimp-user
mailing list