Quoting professor <for...@gimpusers.com>:

> When using Gimp interactively, I can assign names to the different layers,
> e.g. "p1", "p2", "p3" etc.
> Now, is it possible to set a layer active by referring to its name? E.g.:
> gimp-image-set-active-layer "p1" ?

You will have to manually search the list of layers for the one with  
the matching name.

The following function will do so for a given image, returning the  
layerID (or "0" if not found).

(define (find-layer-by-name image s)
   (let* (
       (layer's (vector->list (cadr (gimp-image-get-layers image))))
       (found 0)
     (while (pair? layer's)
       (if (string=? s (car (gimp-layer-get-name (car layer's))))
         (set! found (car layer's))
       (set! layer's (cdr layer's))

Gimp-user mailing list

Reply via email to