Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script-Fu: gimp-image-get-filename does not return string?
#2
(05-06-2022, 03:26 PM)bliss Wrote: I'm probably doing something stupid?
(Scheme and Script-Fu first timer)

Does
Code:
(gimp-image-get-filename 1)
not return a string?
Script-Fu Procedure Browser says so at least.


Code:
> (string-length (gimp-image-get-filename 1))
Error: string-length: argument 1 must be: string

Thank you for your time and effort kind stranger!

I had to do:

Code:
(string-length (car(gimp-image-get-filename 1)))

Where the (car x) is the important part.

Seems to be a Lisp thing where everything returns a  pair or a list and car selects the first element of a pair/list.

Try:

(string-length (car(gimp-image-get-filename 1)))

You need to look at the car and cadr functions that are used to fetch the return values of functions.

Better still, assuming that you have GIMP with Python, use Python for scripting instead - it's much less of a pain in the backside than script-fu!

Edit - you beat me to the answer. But do consider using Python instead.
Reply


Messages In This Thread
RE: Script-Fu: gimp-image-get-filename does not return string? - by programmer_ceds - 05-06-2022, 03:59 PM

Forum Jump: