Thanks for your help everyone. I've managed to make this work, with the following code:
---
(script-fu-register
"script-fu-batch-sticker-landscape" ;func name
"Batch Sticker Landscape" ;menu label
"Stickerize images" ;description
"GG" ;author
"copyright Meh" ;copyright notice
"June 10, 2021" ;date created
"" ;image type that the script works on
SF-STRING "Files" "D:/*.png" ;folder to stickerize
)
(script-fu-menu-register "script-fu-batch-sticker-landscape" "<Image>/File/Batch")
(define (script-fu-batch-sticker-landscape 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))))
(gimp-fuzzy-select drawable 1 1 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-image-select-rectangle image CHANNEL-OP-ADD 11560 8950 2480 980)
(gimp-selection-invert image)
(gimp-selection-grow image 100)
(gimp-selection-invert image)
(gimp-edit-clear drawable)
; Selection is sometimes not perfect, so go through the edges
; and add everything that might have been missed
(gimp-fuzzy-select drawable 1 1 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 1 9930 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 14040 9930 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 14040 1 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
; check the very last pixels on each side for grey line
(gimp-fuzzy-select drawable 1 1 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 1 9932 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 14042 9932 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-fuzzy-select drawable 14042 1 1 CHANNEL-OP-ADD TRUE FALSE 0 FALSE)
(gimp-edit-clear drawable)
(gimp-file-save RUN-NONINTERACTIVE
image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
---
This registers the script with GIMP, and creates the File/Batch menu where I can select the script and run it. Funny enough, it only works with D:/, if I try any other folder it doesn't run. No idea why.
So long, and see you soon I guess.