Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run batch command line in Fu console beginning with 'gimp'
#7
(09-24-2022, 09:07 PM)Gimpnik Wrote:
(09-24-2022, 12:35 PM)Ofnuts Wrote: gimp -i -b '(batch-crop-to-content "D:\Test\*.png") is a shell/terminal command that calls Gimp, not a script-fu instruction. You cannot use it in the script-fu console.
Clear statement!

(09-24-2022, 12:35 PM)Ofnuts Wrote: Gimp batch is executed by calling Gimp from a terminal (gimp -i -b, and giving it a script-fu/python-fu script to execute ('(batch-crop-to-content "D:\Test\*.png")').

If you mean script-fu instruction would be only this part, so it does not work like that either directly in fu console:
Code:
(batch-crop-to-content "D:\Test\*.png")

I receive:

Code:
> (batch-crop-to-content "D:\Test\*.png")
()


(09-24-2022, 12:35 PM)Ofnuts Wrote: To make things even more confusing the syntax of shell commands (in particular, relative to single quotes and double quotes) is different between Windows and Unix (Linux and OSX) so make sure you follow examples for the proper OS.

Yes, and here you are absolutely right!

The solution is with the following syntax (in Windows Batch scripts each double quote of the inside pair must be escaped and depending on this usually succeeds with the character "\", so that this part can be passed as one argument correctly and not fragmented in many wrong arguments):
Code:
gimp -i -b "(batch-crop-to-content \"*.png\")" -b "(gimp-quit 0)"

and finally it works !
Thanks

Conclusion:
I already realize that as a Windows (and not Ubuntu … Linux) user I will experience a lot of stumbling traps here.
I wonder now why it is "as batch script" with wrong syntax everywhere in many posts/blogs, and I just blindly relied on it being correct in any case, however, from now on I will pay more attention.

Well if you want to learn a bit of Python there are working examples out there.
Reply


Messages In This Thread
RE: Run batch command line in Fu console beginning with 'gimp' - by Ofnuts - 09-25-2022, 12:00 PM

Forum Jump: