Trouble calling running batch script in Windows XP
This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
Trouble calling running batch script in Windows XP | Sam Kuper | 08 Nov 16:17 |
Trouble calling running batch script in Windows XP | Kevin Cozens | 08 Nov 16:45 |
Trouble calling running batch script in Windows XP | Sven Neumann | 08 Nov 17:42 |
Trouble calling running batch script in Windows XP | Sam Kuper | 08 Nov 18:01 |
Trouble calling running batch script in Windows XP | Sam Kuper | 08 Nov 18:09 |
Trouble calling running batch script in Windows XP | saulgoode@flashingtwelve.brickfilms.com | 10 Nov 17:15 |
Trouble calling running batch script in Windows XP | Sam Kuper | 12 Nov 15:32 |
Trouble calling running batch script in Windows XP | Kevin Cozens | 12 Nov 17:19 |
Trouble calling running batch script in Windows XP | Sven Neumann | 12 Nov 19:39 |
Trouble calling running batch script in Windows XP
Dear all,
I have been having difficulty running the following batch script:
; ------------------
; BEGIN SCRIPT
; ------------------
(define (batch-CUPify pattern
image
drawable)
(let* ( (filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* (
(filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
; Erode the image (plug-in-erode 1 image drawable 1 1 0.5 7 128 128)
; Photocopy the image (plug-in-photocopy 1 image drawable 35.51 0.583 0.342 0.200)
; Erode the image (plug-in-erode 1 image drawable 1 1 0.5 7 128 128)
; Flush the display (gimp-displays-flush)
; Save the image
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist))))
)
(script-fu-register "batch-CUPify"
"Batch-CUPify"
"Make an image look like it was scanned to PDF by CUP"
"Sam Kuper"
"Sam Kuper"
"2007"
"GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer to process" 0)
; ------------------
; END SCRIPT
; ------------------
I am using GIMP 2.4.1 on Windows XP, and I am trying to run the script by going to the command prompt, changing to a directory full of .png files I want to process with the script, and entering the command:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
This gives me the following messages:
"GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\*.png)'' failed: Invalid argument
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\'(gimp-quit' failed: No such file or directory
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\0)'' failed: No such file or directory
No batch interpreter specified, using the default 'plug-in-script-fu-eval'. batch command: executed successfully."
I would be very grateful for any help you can offer.
Many thanks in advance,
Sam
Trouble calling running batch script in Windows XP
Sam Kuper wrote:
I have been having difficulty running the following batch script:
; ------------------ ; BEGIN SCRIPT
; ------------------(define (batch-CUPify pattern image
drawable)
[snip]
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
I have only taken a quick look at the script. The most obvious problem is that you defined it as needing three parameters and only pass it one on the command line. Based on what I see in the script and how you are trying to use it you don't need the image and drawable parameters.
If you are only going to use this script via batch mode you don't need the register block.
Trouble calling running batch script in Windows XP
Hi,
On Thu, 2007-11-08 at 15:17 +0000, Sam Kuper wrote:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
The correct syntax to pass multiple batch commands to GIMP 2.4 is:
gimp-2.4 -i -b '(batch-CUPify "*.png")' -b '(gimp-quit 0)'
In other words, only one command per --batch or -b option. But you may use this option several times.
Sven
Trouble calling running batch script in Windows XP
Dear Sven,
Thank you. However, I still receive the following messages:
"GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_friend_backup\*.png)'' failed: Invalid argument
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_friend_backup\0)'' failed: No such file or directory
No batch interpreter specified, using the default 'plug-in-script-fu-eval'. batch command: executed successfully. batch command: executed successfully."
Is this because I need to escape the right parenthesis and double-quote mark somehow?
Many thanks,
Sam
On 08/11/2007, Sven Neumann wrote:
Hi,
On Thu, 2007-11-08 at 15:17 +0000, Sam Kuper wrote:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
The correct syntax to pass multiple batch commands to GIMP 2.4 is:
gimp-2.4 -i -b '(batch-CUPify "*.png")' -b '(gimp-quit 0)'
In other words, only one command per --batch or -b option. But you may use this option several times.
Sven
Trouble calling running batch script in Windows XP
Dear Sven,
Running the same command in the same directory but using MinGW instead of the Windows XP Command Prompt. This gives me the following messages:
"No batch interpreter specified, using the default 'plug-in-script-fu-eval'. batch command: experienced an execution error."
I hope this information may be of some help in solving the problem I'm having.
Many thanks again for your help,
Sam
On 08/11/2007, Sam Kuper wrote:
Dear Sven,
Thank you. However, I still receive the following messages:
"GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_friend_backup\*.png)'' failed: Invalid argument
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_friend_backup\0)'' failed: No such file or directory
No batch interpreter specified, using the default 'plug-in-script-fu-eval'.
batch command: executed successfully. batch command: executed successfully."Is this because I need to escape the right parenthesis and double-quote mark somehow?
Many thanks,
Sam
On 08/11/2007, Sven Neumann wrote:
Hi,
On Thu, 2007-11-08 at 15:17 +0000, Sam Kuper wrote:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
The correct syntax to pass multiple batch commands to GIMP 2.4 is:
gimp-2.4 -i -b '(batch-CUPify "*.png")' -b '(gimp-quit 0)'
In other words, only one command per --batch or -b option. But you may use this option several times.
Sven
Trouble calling running batch script in Windows XP
I do not believe that single-quoting a command line argument in Windows works the same as BASH (Linux). Try using double-quotes and escape any double-quotes which appear in your argument:
gimp -i -b "(batch-CUPify \"*.png\")" -b "(gimp-quit 0)"
If you include directories in your path, also escape your backslashes:
gimp -i -b "(batch-CUPify \"D:\\Documents and Settings\\spk30\\Desktop\\alison_sl1_dear_friend_backup\\*.png\")" -b "(gimp-quit 0)"
You may need to experiment as I do not run Windows and have no way of testing the commands.
I am using GIMP 2.4.1 on Windows XP, and I am trying to run the script by going to the command prompt, changing to a directory full of .png files I want to process with the script, and entering the command:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
This gives me the following messages:
"GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\*.png)'' failed: Invalid argument
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\'(gimp-quit' failed: No such file or directory
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\0)'' failed: No such file or directory
No batch interpreter specified, using the default 'plug-in-script-fu-eval'.
batch command: executed successfully."I would be very grateful for any help you can offer.
Many thanks in advance,
Sam
Trouble calling running batch script in Windows XP
Dear Saul,
Thanks for your help. I was eventually successful in running my batch GIMP script from the Windows XP command line, by using either of the following commands:
gimp-2.4 -i -b "(batch-CUPify \"D:\\Documents and Settings\\spk30\\Desktop\\alison_sl1_dear_friend_backup\\*\") (gimp-quit 0)"
gimp-2.4 -i -b "(batch-CUPify \"*.png\") (gimp-quit 0)"
and altering the script to read thus:
; Batch apply the CUPify script
(define (batch-CUPify pattern)
(let* ( (filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* (
(filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-get-active-layer image))))
; Erode the image (plug-in-erode 1 image drawable 1 1 0.5 7 128 128)
; Photocopy the image (plug-in-photocopy 1 image drawable 35.51 0.583 0.342 0.200)
; Erode the image (plug-in-erode 1 image drawable 1 1 0.5 7 128 128)
; Flush the display (gimp-displays-flush)
; Save the image
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist))))
)
(script-fu-register "batch-CUPify"
"Batch-CUPify"
"Make an image look like it was scanned to PDF by CUP"
"Sam Kuper"
"Sam Kuper"
"2007"
"GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer to process" 0)
; End script
Many thanks for the help,
Sam Kuper
On 10/11/2007, saulgoode@flashingtwelve.brickfilms.com < saulgoode@flashingtwelve.brickfilms.com> wrote:
I do not believe that single-quoting a command line argument in Windows works the same as BASH (Linux). Try using double-quotes and escape any double-quotes which appear in your argument:
gimp -i -b "(batch-CUPify \"*.png\")" -b "(gimp-quit 0)"
If you include directories in your path, also escape your backslashes:
gimp -i -b "(batch-CUPify \"D:\\Documents and Settings\\spk30\\Desktop\\alison_sl1_dear_friend_backup\\*.png\")" -b "(gimp-quit 0)"
You may need to experiment as I do not run Windows and have no way of testing the commands.
I am using GIMP 2.4.1 on Windows XP, and I am trying to run the script
by
going to the command prompt, changing to a directory full of .png files
I
want to process with the script, and entering the command:
gimp-2.4 -i -b '(batch-CUPify "*.png")' '(gimp-quit 0)'
This gives me the following messages:
"GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\*.png)'' failed: Invalid argument
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\'(gimp-quit' failed: No such file or directory
GIMP-Error: Opening 'D:\Documents and Settings\spk30\Desktop\alison_sl1_dear_fri end_backup\0)'' failed: No such file or directory
No batch interpreter specified, using the default 'plug-in-script-fu-eval'.
batch command: executed successfully."I would be very grateful for any help you can offer.
Many thanks in advance,
Sam
Trouble calling running batch script in Windows XP
Sam Kuper wrote:
(define (batch-CUPify pattern)
[snip]
)
(script-fu-register "batch-CUPify" "Batch-CUPify"
"Make an image look like it was scanned to PDF by CUP" "Sam Kuper"
"Sam Kuper"
"2007"
"GRAY*"
SF-IMAGE "Image" 0 SF-DRAWABLE "Layer to process" 0)
Good to know you finally got your script running in batch mode.
For future reference, if you are using a script in batch mode only, you don't need the script-fu-register block. The register block is only needed if you want to run your scripts by selecting it from a menu within GIMP.
Also, the argument list expected by your script, as defined above, does not match the argument list you have listed in the register block. Again, not important when running the script from batch mode but it could cause you problems in the future when writing scripts to be run from a menu selection within GIMP.
Trouble calling running batch script in Windows XP
Hi,
On Mon, 2007-11-12 at 11:19 -0500, Kevin Cozens wrote:
For future reference, if you are using a script in batch mode only, you don't need the script-fu-register block. The register block is only needed if you want to run your scripts by selecting it from a menu within GIMP.
That is not entirely correct. You can only omit the registration for Script-Fu scripts if you are using the default batch interpreter which happens to be Script-Fu. For scripts written in other languages, or if you use a different batch interpreter, the script procedure has to be registered with the PDB and that is what script-fu-register is doing.
Sven