It is currently Sat Jun 22, 2024 9:26 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Cannot run test script-fu script via console
PostPosted: Sat Jun 05, 2021 1:18 pm  (#1) 
Offline
New Member

Joined: Jun 05, 2021
Posts: 3
GIMP Version: 2.10.24
Operating System: Windows
OS Version: Windows 10
GIMP Experience: New User



Hello, I'm having a very unusual problem when experimenting with running a very basic scm script.

I have one version of the script that is this:
(define (script-fu-test)
(gimp-message "no variable TEST!")
)


When I run this code with the command line prompt
gimp-2.10.exe -i -b "(script-fu-test)" -b "(gimp-quit 0)" 

it performs as expected, outputting "no variable TEST!" in the GIMP output window, after which it reports that the 'batch command executed succesfully' and then prompts me to press any key to exit. This is all well and good.

However, when I modify the script as such:
(define (script-fu-test strpass)
(gimp-message "no variable TEST!")
(gimp-message (string-append "TEST! with" strpass))
)

and I input the command line prompt
gimp-2.10.exe -i -b "(script-fu-test "stringy thingy TEST")" -b "(gimp-quit 0)"

OR the command line prompt
gimp-2.10.exe -i -b '(script-fu-test "stringy thingy TEST")' -b "(gimp-quit 0)"

then the GIMP output window only reports that the 'batch command executed successfully'; but this is clearly not the case, since if it had executed at all, then it should have written at least "no variable TEST!" to the GIMP output console!

Further experiments with the command line syntax have done no good: using escape characters as in
gimp-2.10.exe -i -b "(script-fu-test \"stringy thingy\")" -b "(gimp-quit 0)" 

causes GIMP to halt, reporting an 'Error: Error reading string'.

I'm not sure what I'm doing wrong here: I've based my code on the example given on the gimp website's basic batch tutorial (I can't post a link as a new user, but it's the first result on Google when searching for "gimp batch processing"), and tried formatting my command line prompt based on examples shown on forums like this one, but my command line doesn't seem to be willing to execute any code to which I'm passing a string, yet it doesn't give me any error messages either, instead acting as though the script executed despite that clearly not being the case.


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Sat Jun 05, 2021 3:44 pm  (#2) 
Offline
GimpChat Member

Joined: Apr 19, 2021
Posts: 121
Location: France
Hello, :)

I don't know Scheme well. I believed that "define" always take only two arguments. Is it the case ? If so, I would think you can fix it by add "begin".

Hope this helps.

_________________
Photo to cartoon : https://github.com/cl4cnam/gimp_cartoon_plugin


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Sat Jun 05, 2021 4:57 pm  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
Did you try python instead?

https://stackoverflow.com/questions/444 ... 0#44435560

_________________
Image


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Sat Jun 05, 2021 6:38 pm  (#4) 
Offline
New Member

Joined: Jun 05, 2021
Posts: 3
ofnuts wrote:
Did you try python instead?


I must be honest: I've spent hours on this already to the point where I've realized Python would be more efficient (went ahead and re-installed Python on my machine even before making this thread), but I'm also so frustrated by script-fu/scheme that I really want to "beat" this issue, efficiency be damned. I was hoping there was a simple fix that more experienced folks would be able to help me with, but if this is a really arcane problem I will just give up on the script-fu side of things and jump to Python.


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Sun Jun 06, 2021 1:46 am  (#5) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Give this a try:
(define (script-fu-test strpass)
(begin
  (gimp-message "no variable TEST!")
  (gimp-message (string-append "TEST! with" strpass))
)
)


and use the escaped double-quotes version of the command line.


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Sun Jun 06, 2021 1:11 pm  (#6) 
Offline
New Member

Joined: Jun 05, 2021
Posts: 3
paynekj wrote:
Give this a try:
(define (script-fu-test strpass)
(begin
  (gimp-message "no variable TEST!")
  (gimp-message (string-append "TEST! with" strpass))
)
)


and use the escaped double-quotes version of the command line.


I tried this, but it's reproducing the same odd behavior of the initial script, either failing to work due to bad or missing arguments, or else "successfully" running without even executing the unappended gimp-message function.


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Mon Jun 07, 2021 3:56 am  (#7) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
Works perfectly for me:

C:\temp>"\Program Files\GIMP 2.10\bin\gimp-console-2.10.exe" -i -b "(script-fu-test \"stringy thingy\")" -b "(gimp-quit 0)"
script-fu.exe-Warning: no variable TEST!

script-fu.exe-Warning: TEST! withstringy thingy

batch command executed successfully


Attachment:
testusername.scm [149 Bytes]
Downloaded 89 times


Be careful that you haven't created two versions of script-fu-test as all scripts share the same name-space and if you've got a second version it will overwrite the first in memory, but how the overwrite happens will depend on which order the files are loaded.


Top
 Post subject: Re: Cannot run test script-fu script via console
PostPosted: Tue Jun 08, 2021 5:40 am  (#8) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4750
TestUserName wrote:
ofnuts wrote:
Did you try python instead?


I must be honest: I've spent hours on this already to the point where I've realized Python would be more efficient (went ahead and re-installed Python on my machine even before making this thread), but I'm also so frustrated by script-fu/scheme that I really want to "beat" this issue, efficiency be damned. I was hoping there was a simple fix that more experienced folks would be able to help me with, but if this is a really arcane problem I will just give up on the script-fu side of things and jump to Python.


If you are on windows you shouldn't install Python (or at least be very careful). AFAIK installing Python after Gimp breaks the Python support in Gimp (which comes with its own Python which conflicts with the one installed separately). Things can possibly work if you install Python first and then Gimp.

_________________
Image


Top
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Looking for Script Coder to make Script of my VHS effect

2

No new posts Attachment(s) A liitle Start Help with a Script-Fu Script

3

No new posts GIMP 2.10 console etc Macbook

0

No new posts Attachment(s) Script-fu

6

No new posts Attachment(s) Old script Token

2



* Login  



Powered by phpBB3 © phpBB Group