On Thu, 24 Feb 2005, Andreas Waechter wrote:

> Date: Thu, 24 Feb 2005 14:58:37 +0100
> From: Andreas Waechter <[EMAIL PROTECTED]>
> To: gimp-user@lists.xcf.berkeley.edu
> Subject: [Gimp-user] Script-Fu: documentation of SF-ADJUSTMENT and others?
> Hi,
> I am trying to write a script-fu script.
> No, I am (nearly) done with the script itself - if I
> hardcode the parameters ...
> Now it needs some parameters given by the user (hardcoding
> them is not good once the script is out of testing phase).

If your copy of the gimp includes the sphere test (test-sphere.scm) You
should read through it first.  To the user the script may be ugly but to
the programmer it provides invaluable comments and clear examples that
help you get started with Script-Fu.

> SF-ADJUSTMENT _"Value" '(10 1 100 1 10 0 1)
> By trial and error I found out:
> 1st value (10)  is the value displayed at startup.
> 2nd value (1)   is the lowest possible value.
> 3rd value (100) is the highest possible value.
> 4th value (1)   is the increment/decrement when the little
> arrows are used
> But what is the meaning of the other 3 (10, 0, 1)?

; Usage:
; SF-ADJUSTMENT "label" '(value, lower, upper, step_inc, page_inc, digits,

page inc is a larger step value (best to go with 10 usualy) when page up
or page down are used rather than the arrows.

digits ... I dont think I need to explain

type allows you to show a slider in addition to the adjustement box (aka

> Also I look for a way to initialize such an
> SF-ADJUSTMENT with the image-width or image height, i.e. set
> the first value not to a fixed number but to the image
> dimension (either width or height).

I'm fairly sure it is possible but difficult.  Some of scripts included
with the gimp will give you ideas on how to do this but I decided not to
spend too much time trying to figure it out.  (When you have all the rest
of your script figured out I try and point you in the right direction on
this if you are still interested.)

It is far easier to structure your script in a different way, I would use
perecentages of Image size or something else.  Describe what the script is
supposed to be doing and I might be able to make a more helpful suggestion
or even help you with your script (or recommened a similar script someone
else has written already).

> Once I got that into operation, I'd like to "couple" the
> boxes for width and height together, in the same way the
> width/height boxes are coupled together in
> "<image>/Image/Scale Image"

Short answer: Script Fu does not offer this functionality.

> In scripts on my machine I found these:

Read test-sphere.scm and try out a few things and then read it again but
after you have read it feel free to ask more questions.

> Ok, these are pretty obvious, also the
> SF-OPTION   (taking a list of Strings giving the selected
> string)
> Are there more?

It is easier for me to just point out some of the limitations of Script-Fu
There is currently no way to have a Radio list in Script-Fu.  Script-Fu
does not support UTF but it planned that Tiny-Fu (also scheme) will and
then it will replace Script-Fu.

I cannot stress enough how much it helps to know what it is exactly you
are trying to do and it is especially helpful if you show us the code so
that we can help.

Hope that helps

Please do take a look at my GNU Image Manipulation Program Scripts
and if you think they could be improved or have any suggestions of
new scripts that might be interesting to write please let me know.


Alan Horkan

Inkscape, Draw Freely  http://inkscape.org
Abiword is Awesome http://abisource.com

Gimp-user mailing list

Reply via email to