Re: [Gimp-user] Question about scripting

2022-07-30 Thread Kevin Cozens

On 2022-07-28 23:00, Jean-Pierre HOARAU wrote:

 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)"


On 2022-07-30 11:14, Ofnuts via gimp-user-list wrote:
> A problem you have is the multiple layers looking at your double quotes:

Ofnuts is correct that the problem is with the nested double quotes. The 
inner ones that are before and after the file name need to be escaped.


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

--
Cheers!

Kevin.

http://www.ve3syb.ca/   | "Nerds make the shiny things that
https://www.patreon.com/KevinCozens | distract the mouth-breathers, and
| that's why we're powerful"
Owner of Elecraft K2 #2172  |
#include  | --Chris Hardwick
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


Re: [Gimp-user] Question about scripting

2022-07-30 Thread Ofnuts via gimp-user-list

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:gimp-user-list@gnome.org
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:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


Re: [Gimp-user] Question about scripting

2022-07-30 Thread Ofnuts via gimp-user-list

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 "(gim p-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-qu it 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 single quotes for the scrpit-fu strin

printf "%s\n" gimp -i -b "(file-jpeg-load RUN-NONINTERACTIVE
'/home/user/ev.jpg' '/home/user/ev.jpg')" -b "(gimp-qu it 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:gimp-user-list@gnome.org
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:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


Re: [Gimp-user] Question about scripting

2022-07-30 Thread Adrian Midgley via gimp-user-list
I'd also find an example interesting.

Adrian Midgley (Retired(Mostly))

On Sat, 30 Jul 2022, 05:21 Jean-Pierre HOARAU, 
wrote:

> Thank you very much for the link. It is very useful. But my problem is not
> bash but the parameters to give in command line to run gimp procedures. I
> don't understand very well what I must give for args in a gimp procedure.
> This is why I asked for an example with a file-jpeg-load or file-jpeg-save
> procedure. I get some error messages that I don't understand. So my
> question remains, what are parameters to give to these procedures? Could
> someone write me this command line? So I will have an example that I can't
> find on the net. Thank you.
>
> Le sam. 30 juil. 2022 à 02:25, Shlomi Fish  a
> écrit :
>
> > hi ,
> >
> > On Fri, 29 Jul 2022 05:00:39 +0200
> > 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)"
> > >
> >
> > Please read about bash/zsh/ksh/etc. quoting/escaping:
> >
> > https://mywiki.wooledge.org/BashFAQ
> >
> > [also note https://www.shlomifish.org/open-source/anti/csh/ ]
> >
> > > Thank you in advance.
> > > ___
> > > gimp-user-list mailing list
> > > List address:gimp-user-list@gnome.org
> > > List membership:
> https://mail.gnome.org/mailman/listinfo/gimp-user-list
> > > List archives:   https://mail.gnome.org/archives/gimp-user-list
> >
> >
> >
> > --
> >
> > Shlomi Fish   https://www.shlomifish.org/
> > https://www.shlomifish.org/open-source/resources/tech-tips/
> >
> > If a million Shakespeares had to write together, they would write like a
> > monkey.
> > — based on Stephen Wright, via Nadav Har’El.
> >
> > Please reply to list if it's a mailing list post -
> https://shlom.in/reply
> > .
> >
> ___
> gimp-user-list mailing list
> List address:gimp-user-list@gnome.org
> 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:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list