Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
script-fu help
#6
Below is a script to print the results of calling the three procedures Scallact listed in post #2.
It shows that in scheme gimp turns the returned GFile into a string.

Example of the script's printouts:
gimp-image-get-file: Is a string: /tmp/test-filenames.xcf
gimp-image-get-name: Is a string: test-filenames.xcf
gimp-image-get-xcf-file: Is a string: /tmp/test-filenames.xcf

Code:
#!/usr/bin/env gimp-script-fu-interpreter-3.0

(define (print-info procedure-name value)
 (display procedure-name)
 (display ": ")

 (cond
   ((not (string? value)) (display "Is not a string: "))
   ((string=? value "")   (display "Is an empty string."))
   (else                  (display "Is a string: "))
 )

 (display value)
 (newline)
)

(define (script-fu-test-filename-v3 image drawables)
 (script-fu-use-v3)

 (let ((file (gimp-image-get-file image))
       (name (gimp-image-get-name image))
       (xcf-file (gimp-image-get-xcf-file image)))

   (print-info "gimp-image-get-file" file)
   (print-info "gimp-image-get-name" name)
   (print-info "gimp-image-get-xcf-file" xcf-file)
 )
)

(script-fu-register-filter "script-fu-test-filename-v3"
   "Test Filename v3"
   "Print out some filename tests."
   "teapot"
   "teapot"
   "2025"
   "*"
   SF-ONE-OR-MORE-DRAWABLE
)

(script-fu-menu-register "script-fu-test-filename-v3" "<Image>/Image")
Reply


Messages In This Thread
script-fu help - by egrivel - 03-08-2026, 07:43 PM
RE: script-fu help - by Scallact - 03-08-2026, 11:52 PM
RE: script-fu help - by egrivel - 03-09-2026, 12:25 AM
RE: script-fu help - by Scallact - 03-09-2026, 09:05 AM
RE: script-fu help - by rich2005 - 03-09-2026, 11:23 AM
RE: script-fu help - by teapot - Yesterday, 04:57 AM

Forum Jump: