.scm no longer showing up in Script-fu

I hope I’ve posted in the right place; if not feel free to remove. I have a batch script for the “unsharp mask” filter. It was working well in an older version of Gimp. However, once I installed v. 2.8.22 it refuses to appear in Script-fu. I have tried everything commonly posted in the chats/forums and am out of ideas. I am not a coder, so hopefully it is a simple fix that I am just not seeing. Any advice is appreciated. Thanks!

(define (batch-unsharp-mask pattern
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
(plug-in-unsharp-mask RUN-NONINTERACTIVE
image drawable radius amount threshold)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))

To make it appear in the menus it should “register” (in other words, tell Gimp how it wants to be called: what the arguments its are, type of image it can work with, etc…)

However, given that it iterates on files and saves them directly, it is written to be used as a batch from the command line and not as a UI script so not registering is perfectly fine but then you won’t find it in the menus, and it has to be entirely specified in a -b argument in a Gimp command to be used.

Otherwise you can also look at ImageMagick -sharpen or -unsharp operators in a mogrify command for the same results obtained faster and in a more maintainable way.

Thank you, Ofnuts! For some bizarre reason, I tried the gimp -b prefix and it gave me an error, then I ran the command without “gimp -b” and by some miracle it works! Still can’t see it in the menu, but I’ll take it as a win :slight_smile:

gimp -b ‘(batch-unsharp-mask “.tif" 19.0 1.2 0.0)’
Error: ( -b '(batch-unsharp-mask "
.tif” 19.0 1.2 0.0)’ : 1) eval: unbound variable: gimp

(batch-unsharp-mask “*.tif” 19.0 1.2 0.0)