Here you go, Joe (not sure what you mean by "lock the layer"... link it's position, or lock its alpha (so I didn't include that). Just save it as a scm file in your scripts and assign it to a hot key:
Code:
(define (script-fu-joesaction img inLayer)
(let *
(
(new-layer (car (gimp-layer-copy inLayer TRUE))) ;create a duplicate
)
; it begins here
(gimp-image-undo-group-start img)
;copy the layer
(gimp-image-add-layer img new-layer -1) ; create the copy as a new layer
(gimp-drawable-set-visible new-layer FALSE) ; set invisible
(gimp-image-lower-layer-to-bottom img new-layer) ; move to bottom
(gimp-image-set-active-layer img inLayer); set active layer back to initial layer
;done
(gimp-image-undo-group-end img)
)
)
(script-fu-register "script-fu-joesaction"
"<Image>/Filters/Joe Action"
"4 steps."
"Rob A"
"Rob A"
"June 2008"
""
SF-IMAGE "image" 0
SF-DRAWABLE "drawable" 0
)