script-fu argument/parameter formats - Printable Version

+- (
+-- Forum: GIMP (
+--- Forum: Extending the GIMP (
+---- Forum: Scripting questions (
+---- Thread: script-fu argument/parameter formats (/Thread-script-fu-argument-parameter-formats)

script-fu argument/parameter formats - dhugg - 03-13-2018

i am new to the forum so if i do anything incorrectly please feel free to educate me.    thanks

i am trying to learn how to use script-fu with some of the pre-supplied scripts (using spheredesigner as example). my research resulted in an overload of info on how to write and execute scripts.
i would like to know if there is anywhere i can see the actual "using" of a script that already exists. in the case of spheredesigner, i understand that it requires input of a "run mode" an "image" and a "drawable". i am trying to find an example or information on the format of these arguments. for example how is the image name formatted? would it be the whole name includiong path, a image number, a layer name or a million other possibilities?

i guess iam asking were do i find my options/formatting of the input parameters to an existing script?

thanks in advance, dhugg

RE: script-fu argument/parameter formats - Ofnuts - 03-13-2018

If you are beginning, don't use script-fu as a programming language, but use python. It is simpler, more powerful used for many more things that Gimp scripts. It is a very popular language these days, so you'll find plenty of tutorials/sites (for pure python problems, this forum is quite beginner-friendly).

Here is one of my collections of Python scripts for Gimp. Check the smaller ones that are likely easier to understand. I can and will answer all your questions about them.

Two warnings:

1) use a programmer's editor. This cannot be stressed enough. It will help you get the code right a lot faster, by showing you unbalanced quotes/parentheses and the like, and keeping the code tidy. And unlike the default editors, it won't try to be clever and replace characters (for instance, plain double quotes replaced by open/close quotes). A good free one is notepad++.

2) debugging scripts under Windows can be a bit tricky. Some techniques are described here.

RE: script-fu argument/parameter formats - dinasset - 03-13-2018

I fully agree with Ofnuts.
I also started writing filters in script-fu, but after a suggestion from Ofnuts similar to this one here, I moved to python-fu.
It's much more concise and powerful.
And easier to re-read and understand.