Re: [Gimp-user] Scheme - image ID



On 16-03-12 02:14 PM, ugajin talktalk net wrote:
I want to get the id from within the script. I found the answer. Not
sure why it wasn't working when I first tried it. I hadn't made the
connection between image id and the title bar data.

Still don't know how to get the item id as required by (gimp-item-get-
image item) function.

You said you found the answer then your last statement seems to indicate you haven't.

Apart from the previous suggestions on how to find the image ID I had another thought. If you are writing a script where you want to right click an image and run your script from the menu that will pop up you can set up your script so the image ID and drawable ID are automatically passed to your script.

In the script-fu-register block where you have the list of SF-* parameters, you add two lines right before any other SF-* parameters:
  SF-IMAGE       "Image"    0
  SF-DRAWABLE    "Drawable" 0

In the define for your script you would add "image" and "drawable" as the first two parameters expected by your script. You can use any variable names you want in place of "image" and "drawable".

If your define was
  (define (my-script-fu-script param1 param2)
you would change it to
 (define (my-script-fu-script image drawable param1 param2)

The variable name "image" will automatically be set to the ID of the image that you right clicked.

--
Cheers!

Kevin.

http://www.ve3syb.ca/           |"Nerds make the shiny things that distract
Owner of Elecraft K2 #2172      | the mouth-breathers, and that's why we're
                                | powerful!"
#include <disclaimer/favourite> |             --Chris Hardwick


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]