It is currently Fri Apr 19, 2024 3:34 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 6:29 am  (#1) 
Offline
GimpChat Member
User avatar

Joined: Mar 27, 2015
Posts: 22
Hi,

I'm trying to run gimp from a windows .bat file with some parameters passed

"C:\Program files\GIMP 2\bin\gimp-2.8" -b -i '(script-fu-RemapMosaic "batTestOverlapScript64.xcf" "batTestOverlapScript64.xcf" 4 4 64 42 FALSE TRUE TRUE 4 TRUE 4 TRUE 4)'

However the batch completed successfully without saving the image.
So I then ran it without the -i option.

"C:\Program files\GIMP 2\bin\gimp-2.8" -b -i '(script-fu-RemapMosaic "batTestOverlapScript64.xcf" "batTestOverlapScript64.xcf" 4 4 64 42 FALSE TRUE TRUE 4 TRUE 4 TRUE 4)'

Then I could see, in the gimp error console that all the parameters are being prefixed with the path
of the script location, see below, and it would appear to think they are images to load?

GIMP Error
Opening 'L:\mosiac\scripts\4' failed: No such file or directory

GIMP Error
Opening 'L:\mosiac\scripts\64' failed: No such file or directory

GIMP Error
Opening 'L:\mosiac\scripts\42' failed: No such file or directory

GIMP Error
Opening 'L:\mosiac\scripts\FALSE' failed: No such file or directory

ect...

I'm very confused by it all. The script works ok if I run it from inside Gimp.

Any help much appreciated, thanks.


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: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 7:27 am  (#2) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
A few things to address here.

The -b switch needs to be directly followed the text of the script. If you want to eschew opening an interface then the -i switch should appear before the -b switch in the line.

Does Windows command line permit "apostrophe" quoting? I thought it only recognized double quotes.

You should provide the code for 'script-fu-RemapMosaic' or at least a link to where it can be downloaded. Your error messages suggest that the numeric and boolean arguments are being treated as filenames.

There are letters transposed in the error messages, suggesting that a typographical error in your script is causing it to look in the wrong folder.
Opening 'L:\mosiac\scripts\4' failed: No such file or directory

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 7:39 am  (#3) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
saulgoode wrote:
Does Windows command line permit "apostrophe" quoting?


No, you should replace the apostrophes and run gimp-console instead of gimp:

"C:\Program files\GIMP 2\bin\gimp-console-2.8.exe" -i -b "(script-fu-RemapMosaic \"batTestOverlapScript64.xcf\" \"batTestOverlapScript64.xcf\" 4 4 64 42 FALSE TRUE TRUE 4 TRUE 4 TRUE 4)" -b "(gimp-quit 0)"

Kevin


Top
 Post subject: Re: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 7:47 am  (#4) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Thanks, paynekj.

I do not use Windows, but from some previous reading I gathered it would also be possible to use a HERE document.

"C:\Program files\GIMP 2\bin\gimp-2.8" -b - @'
(script-fu-RemapMosaic "batTestOverlapScript64.xcf" "batTestOverlapScript64.xcf" 4 4 64 42 FALSE TRUE TRUE 4 TRUE 4 TRUE 4)
'@


Note the hyphen after the -b switch. This indicates that GIMP is supposed to read the script code from standard input (not the command line), and the @' ... '@ indicates that the text inside should be provided as standard input to the command.

N.B. I have never tried this.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
 Post subject: Re: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 10:21 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Mar 27, 2015
Posts: 22
Thanks for the response gentlemen, I tried the console... here's what happened.
Still no go.

L:\mosiac\scripts>set SOURCEPATH=\"L:\mosiac\Images\remapMe.xcf\"
L:\mosiac\scripts>echo \"L:\mosiac\Images\remapMe.xcf\"
\"L:\mosiac\Images\remapMe.xcf\"
L:\mosiac\scripts>set FILENAME=\"remapMe.xcf\"
L:\mosiac\scripts>echo \"remapMe.xcf\"
\"remapMe.xcf\"

L:\mosiac\scripts>"C:\Program files\GIMP 2\bin\gimp-console-2.8.exe" -i -b '(scr
ipt-fu-RemapMosaic \"L:\mosiac\Images\remapMe.xcf\" \"remapMe.xcf\" 10 10 32 22
FALSE TRUE TRUE 4 TRUE 3 TRUE 3)' -b "(gimp-quit 0)"

(gimp-console-2.8.exe:3020): LibGimpBase-WARNING **: gimp-console-2.8.exe: gimp_
wire_read(): error
batch command executed successfully

L:\mosiac\scripts>pause
Press any key to continue . . .


Top
 Post subject: Re: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 10:25 am  (#6) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
You left the apostrophes in ?:
'(script-fu-RemapMosaic \"L:\mosiac\Images\remapMe.xcf\" \"remapMe.xcf\" 10 10 32 22 FALSE TRUE TRUE 4 TRUE 3 TRUE 3)'


try
"C:\Program files\GIMP 2\bin\gimp-console-2.8.exe" -i -b "(script-fu-RemapMosaic \"L:\mosiac\Images\remapMe.xcf\" \"remapMe.xcf\" 10 10 32 22 FALSE TRUE TRUE 4 TRUE 3 TRUE 3)" -b "(gimp-quit 0)"


Kevin


Top
 Post subject: Re: running gimp from .bat paths and parameters
PostPosted: Sun Mar 29, 2015 10:31 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: Mar 27, 2015
Posts: 22
Ah, thanks Kevin, I was blinkered to changing the \" , didn't notice that '
Many thanks, the process is working now. Still get a warning message from the console, but the thing does it's task.

:)


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts default parameters

4

No new posts Attachment(s) GMIC no longer puts parameters used into layer name

4

No new posts Find and fill paths if closed, convert closed paths to transparent

1

No new posts Gimp running slow

1

No new posts Attachment(s) error when running potrace

2



* Login  



Powered by phpBB3 © phpBB Group