gimpusers.com logo
German version English version

Not logged in

Sign up! | Lost password?

Latest discussion

  1. gegl-developer | today 12:12 AM
    babl docs
  2. gimp-web | yesterday 10:41 PM
    Windows installers
  3. gimp-user | yesterday 10:23 PM
    How to edit text in both Gimp & Photoshop
  4. gimp-docs | yesterday 05:54 PM
    a new user perspective
  5. gimp-developer | yesterday 07:03 AM
    Nightly builds with buildbot, where can we host?

External news

Poll

How good are you at programming?

OMG, that is nothing for me at all!

I've been coding a little bit but I'm not very fit at it

I'm pretty good at programming and would maybe be able to write a Plug-In for GIMP

I'm very good at programming and I would theoretically be able to hack for the GIMP core

See results

Stats

gimpusers.com RSS feed

GIMP Forums » For GIMP users

Suppressing the "press any character to close this window" message in Script-Fu

Jump to message:

  1. Suppressing the "press... — Dillon, 01 Aug 2010 10:48 AM
    1. Suppressing the "press... — saulgoode@flashin..., 01 Aug 2010 01:25 PM
    2. Suppressing the "press... — Kevin Cozens, 01 Aug 2010 05:01 PM
    3. Suppressing the "press... — Sven Neumann, 02 Aug 2010 10:16 PM
  2. Suppressing the "press... — Dillon, 01 Aug 2010 09:29 PM
  3. Suppressing the "press... — Dillon, 06 Aug 2010 08:28 AM

As a registered user, you can subscribe forum threads in order to get notified when replies are posted. Just log in at the right top of the page if you already have an account, otherwise you can register for free.

Permalink:AANLkTikmj1QOVvCF1ujPD9Ro=wdLnxYwYO7r...
Date:01 Aug 2010 10:48 AM
From:Dillon
Subject:Suppressing the "press any character to close this window" message in Script-Fu
Hi all,

I've written a series of scripts to automate GIMP's script-fu batch
processor. Right now I'm working on starting up multiple asynchronous GIMP
processes.

The problem I'm having right now is with the interactive "press any
character to close this window" message that appears when GIMP finishes
processing a piece of Script-Fu.

I want to suppress that message so that there is no user interaction
required.

Is this possible in Script-Fu?

- Dillon
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview
Permalink:20100801072542.iuw2rfsq8owskw4k@flash...
Date:01 Aug 2010 01:25 PM
From:saulgoode@flashingtwelve.brickfilms.com
Subject:Suppressing the "press any character to close this window" message in Script-Fu
Quoting Dillon <dillononthecoast@gmail.com>:

> The problem I'm having right now is with the interactive "press any
> character to close this window" message that appears when GIMP finishes
> processing a piece of Script-Fu.
>
> I want to suppress that message so that there is no user interaction
> required.

I'm not familiar with that message. Could you provide a little more
detail about your process?

> I've written a series of scripts to automate GIMP's script-fu batch
> processor. Right now I'm working on starting up multiple asynchronous GIMP
> processes.

Unless the image processing you are doing is quite involved, you might
find that running a single GIMP instance to be faster if you pass all
of the filenames to it at once. This way you avoid the somewhat
lengthy startup times that GIMP usually experiences.
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview
Permalink:4C558C33.9030305@ve3syb.ca
Date:01 Aug 2010 05:01 PM
From:Kevin Cozens
Subject:Suppressing the "press any character to close this window" message in Script-Fu
Dillon wrote:
> I've written a series of scripts to automate GIMP's script-fu batch
> processor. Right now I'm working on starting up multiple asynchronous GIMP
> processes.
>
> The problem I'm having right now is with the interactive "press any
> character to close this window" message that appears when GIMP finishes
> processing a piece of Script-Fu.

I don't believe the message has anything to do with Script-Fu. The message
about "press any character..." sounds like a message from a machine running
the Windows operating system and it wants to close a window that was opened
to run a program and that program has now terminated.

You can get more help if you would provide more information about your
batch processing method and how you are invoking GIMP to run Script-Fu scripts.
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview
Permalink:1280780271.2831.2.camel@bender
Date:02 Aug 2010 10:16 PM
From:Sven Neumann
Subject:Suppressing the "press any character to close this window" message in Script-Fu
On Sun, 2010-08-01 at 01:48 -0700, Dillon wrote:
> Hi all,
>
>
> I've written a series of scripts to automate GIMP's script-fu batch
> processor. Right now I'm working on starting up multiple asynchronous
> GIMP processes.
>
>
> The problem I'm having right now is with the interactive "press any
> character to close this window" message that appears when GIMP
> finishes processing a piece of Script-Fu.

You get this message because you are running the copy of GIMP that was
compiled as an interactive application with UI. If you don't want any
UI, then don't start the gimp binary, but use the gimp-console binary
instead.


Sven
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview
Permalink:AANLkTi=_zuXMnkNdB5TbZDRC2xPj24Vox3UQ...
Date:01 Aug 2010 09:29 PM
From:Dillon
Subject:Suppressing the "press any character to close this window" message in Script-Fu
Sorry guys. I should realize that not everyone is following my plot :)

This is the same script / process you guys helped me with a week or two ago.
I am running GIMP on a Windows machine. I have a directory of XCF files
that I want to export to JPG. I have a batch-save-as-jpg script-fu to do
this. The script-fu is invoked from a PowerShell script. That PowerShell
launches the GIMP batch processor and passes in the script-fu function,
scaling percentage, and a file glob.

##########################################################
#
# START SCRIPT-FU
#
##########################################################
(define (batch-save-as-jpg pattern resize)
(let* (
(filelist (cadr (file-glob pattern 1)))
(fileparts)
(jpgname "")
(filename "")
(image 0)
(newimage 0)
(drawable 0)
(x1 0)
(x2 0)
(y1 0)
(y2 0)
(width 0)
(height 0)
(selection-bounds 0)
)
(gimp-message-set-handler 2)
(gimp-message "Preparing to act on the following files")
(gimp-message pattern)
(while (pair? filelist)
; set filename to the name of the current file in the glob
(set! filename (car filelist))
(gimp-message "The current file is: ")
(gimp-message filename)

; set jpgname by tokenizing on "." and taking everything but the last part
(set! fileparts (strbreakup filename "."))
(set! fileparts (butlast fileparts))
(set! jpgname (string-append (unbreakupstr fileparts ".") ".jpg"))
(gimp-message "The new filename will be: ")
(gimp-message jpgname)
; set image from the file, and then get the first layer and set it to
newimage
(gimp-message "Loading File.")
(set! newimage (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))

; scale the image
(gimp-message "Scaling the Image.")
; From the Resize %, calculate the new coordinates
; Select all so we can calculate the image size
(gimp-selection-all newimage)

(gimp-message "Getting the Image Size")
; Get the image size and store in x1, x2, y1, and y2
(set! selection-bounds (gimp-selection-bounds newimage))
(set! x1 (cadr selection-bounds))
(set! y1 (caddr selection-bounds))
(set! x2 (- (cadr (cddr selection-bounds)) x1))
(set! y2 (- (caddr (cddr selection-bounds)) y1))

; De-select the selection
(gimp-selection-none newimage)

(gimp-message "Calculating the new width and height.")
; Calculate the image width, height
(set! width (- x2 x1))
(set! height (- y2 y1))
(set! width (* width resize))
(set! height (* height resize))
(set! width (/ width 100))
(set! height (/ height 100))
(gimp-message "The new width is: ")
(gimp-message (number->string width))
(gimp-message "The new height is: ")
(gimp-message (number->string height))

; set drawable to the newimage
(gimp-message "Setting the Drawable.")
(set! drawable (car (gimp-image-flatten newimage)))
; Scale the image to the new width and height
(gimp-drawable-transform-scale drawable 0 0 width height 0 2 0 3 0)
; Crop the image down to the new scaled size
(gimp-image-crop newimage width height 0 0)
; Re-display the cropped image
(gimp-displays-flush)

; Remove any existing selections
(gimp-selection-none newimage)
; save the drawable from newimage as jpgname
(gimp-message "Saving the new file.")
(gimp-file-save RUN-NONINTERACTIVE newimage drawable jpgname jpgname)
(set! filelist (cdr filelist))

)
)
)

##########################################################
#
# END SCRIPT-FU
#
##########################################################


##########################################################
#
# START POWERSHELL
#
##########################################################

$Resize = 10
$SourcePath = "c:\test\xcf"
$GimpifiedSourcePath = $SourcePath -replace("\\", "\\")
$Gimp = "gimp-2.6.exe"
$GimpParams = @("-i", "-b",
"`"(batch-save-as-jpg\`"$GimpifiedSourcePath\\*.*\`" $Resize)`"", "-b",
"`"(gimp-quit 0)`"")

$p = [diagnostics.process]::Start($Gimp, $GimpParams)
$p.WaitForExit()

##########################################################
#
# END POWERSHELL
#
##########################################################

The Powershell is waiting for the GIMP process to complete before it
continues the script. This is a problem becomes whenever that GIMP command
finishes, it leaves a hanging command-prompt window open that is waiting for
a key press before it will close. This causes the PowerShell to stop
executing.

This is not standard behavior on Windows. Other commands run this way would
briefly launch a command-prompt, execute, complete, and that command prompt
closes on its own. If it's not part of Script-Fu, perhaps it's part of GIMP
batch mode? If it's not GIMP that's waiting for input, perhaps it's a flag
set when launching the executable that tells Windows if it could close the
command prompt. I don't really know where to look for this.

On Sun, Aug 1, 2010 at 12:00 PM,
<gimp-user-request@lists.xcf.berkeley.edu>wrote:

>
>
> Message: 5
> Date: Sun, 01 Aug 2010 11:01:07 -0400
> From: Kevin Cozens <kevin@ve3syb.ca>
> Subject: Re: [Gimp-user] Suppressing the "press any character to close
> this window" message in Script-Fu
> To: gimp-user <gimp-user@lists.xcf.berkeley.edu>
> Message-ID: <4C558C33.9030305@ve3syb.ca>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Dillon wrote:
> > I've written a series of scripts to automate GIMP's script-fu batch
> > processor. Right now I'm working on starting up multiple asynchronous
> GIMP
> > processes.
> >
> > The problem I'm having right now is with the interactive "press any
> > character to close this window" message that appears when GIMP finishes
> > processing a piece of Script-Fu.
>
> I don't believe the message has anything to do with Script-Fu. The message
> about "press any character..." sounds like a message from a machine running
> the Windows operating system and it wants to close a window that was opened
> to run a program and that program has now terminated.
>
> You can get more help if you would provide more information about your
> batch processing method and how you are invoking GIMP to run Script-Fu
> scripts.
>
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview
Permalink:AANLkTinER7ppdVOAY8YpkS2Fz77u-qXMUvJY...
Date:06 Aug 2010 08:28 AM
From:Dillon
Subject:Suppressing the "press any character to close this window" message in Script-Fu
Thank you Sven - that fixed it!

On Tue, Aug 3, 2010 at 12:00 PM, <gimp-user-
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 02 Aug 2010 22:17:51 +0200
> From: Sven Neumann <sven@gimp.org>
> Subject: Re: [Gimp-user] Suppressing the "press any character to close
> this window" message in Script-Fu
> To: Dillon <dillononthecoast@gmail.com>
> Cc: gimp-user@lists.xcf.berkeley.edu
> Message-ID: <1280780271.2831.2.camel@bender>
> Content-Type: text/plain; charset="UTF-8"
>
> On Sun, 2010-08-01 at 01:48 -0700, Dillon wrote:
>
> You get this message because you are running the copy of GIMP that was
> compiled as an interactive application with UI. If you don't want any
> UI, then don't start the gimp binary, but use the gimp-console binary
> instead.
>
>
> Sven
>
>
>
>
_______________________________________________
Gimp-user mailing list
Gimp-user@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-user
↑Back to thread overview

Adobe® Photoshop® is a registered trademark of Adobe Systems, Inc. Linux is a trademark of Linus Torvalds. Ubuntu and Canonical are registered trademarks of Canonical Ltd. | Clock times are shown as CET / CEST | Imprint / Privacy policy | powered by bitfire it services | sponsored by Hirners Hotel Guide