Re: [Gimp-user] Question about scripting

Ofnuts via gimp-user-list <[email protected]> Sat, 30 Jul 2022 17:30:20 +0200
Newsgroups gmane.comp.video.gimp.user
Message-ID <[email protected]>
Ok, so some "clever" reformatting of my answer happened, so let's try
again. If this is still garbled, here is a screenshot of what I mean:
https://imgur.com/vBKHf1g

A problem you have is the multiple layers looking at your double quotes:
the shell interpreter that calls Gimp, and
the script-fu interpreter. Quotes are processed and not seen by Gimp and
script-fu.

Since you are on a Unix shell, try this:

     printf "%s\n" gimp -i -b "(file-jpeg-load RUN-NONINTERACTIVE
"/home/user/ev.jpg" "/home/user/ev.jpg")" -b "(gimp-quit 0)"

This will print a line per "token" passed to the actual command:

     * gimp
     * -i
     * -b
     * (file-jpeg-load RUN-NONINTERACTIVE /home/user/ev.jpg
/home/user/ev.jpg)
     * -b
     * (gimp-quit 0)

As you can see, the quotes around the file names have been removed. You
have to either escape them:

     printf "%s\n" gimp -i -b "(file-jpeg-load RUN-NONINTERACTIVE
\"/home/user/ev.jpg\" \"/home/user/ev.jpg\")" -b "(gimp-quit 0)"

     * gimp
     * -i
     * -b
     * (file-jpeg-load RUN-NONINTERACTIVE "/home/user/ev.jpg"
"/home/user/ev.jpg")
     * -b
     * (gimp-quit 0)

Or use outer single quotes (but this makes variable substitution in the
shell a bit contrived:

     printf "%s\n" gimp -i -b '(file-jpeg-load RUN-NONINTERACTIVE
"/home/user/ev.jpg" "/home/user/ev.jpg")' -b '(gimp-quit 0)'

     * gimp
     * -i
     * -b
     * (file-jpeg-load RUN-NONINTERACTIVE "/home/user/ev.jpg"
"/home/user/ev.jpg")
     * -b
     * (gimp-quit 0)

Or, if script-fu supports it (that's what I do for pythin-fu), outer
double qoutes and inner single quotes for the scrpit-fu strings

     printf "%s\n" gimp -i -b "(file-jpeg-load RUN-NONINTERACTIVE
'/home/user/ev.jpg' '/home/user/ev.jpg')" -b "(gimp-quit 0)"

     * gimp
     * -i
     * -b
     * (file-jpeg-load RUN-NONINTERACTIVE '/home/user/ev.jpg'
'/home/user/ev.jpg')
     * -b
     * (gimp-quit 0)


On 29/07/2022 05:00, Jean-Pierre HOARAU wrote:
> I'm trying to write a script shell and use a procedure. I don't understand
> how to give the parameters to the script. I do not have the good number or
> parameters. Can someone write to me the command line that I have to enter
> to use the procedures, for example, file-jpeg-load and file-jpeg-save? I
> tried this and it doesn't work:
>
> gimp -i -b "(file-jpeg-load RUN-NONINTERACTIVE "/home/user/ev.jpg"
> "/home/user/ev.jpg")" -b "(gimp-quit 0)"
>
> Thank you in advance.
> _______________________________________________
> gimp-user-list mailing list
> List address:[email protected]
> List membership:https://mail.gnome.org/mailman/listinfo/gimp-user-list
> List archives:https://mail.gnome.org/archives/gimp-user-list

_______________________________________________
gimp-user-list mailing list
List address:    [email protected]
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list