![]() |
|
script-fu help - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: script-fu help (/Thread-script-fu-help) |
script-fu help - egrivel - 03-08-2026 Hi, I have a script-fu script I wrote back in 2003, which I use to save the current image in the ../edited folder, and mark the image as "saved". I have been using this script in every version of Gimp since 2003 without changes, but when I tried to use it in Gimp 3.0 I got the error: Execution error for 'DoIt': Error: eval: unbound variable: gimp-image-get-filename Does anybody know if the function gimp-image-get-filename has changed in Gimp 3.0, or if I'm missing something in my Gimp installation? Thanks, Eric RE: script-fu help - Scallact - 03-08-2026 The procedure browser lists those: gimp-image-get-file gimp-image-get-name gimp-image-get-xcf-file I don't know which one you're looking for, but the procedure browser give some description (you should use it, it's in the help menu) RE: script-fu help - egrivel - 03-09-2026 (03-08-2026, 11:52 PM)Scallact Wrote: The procedure browser lists those: Thanks for the response. gimp-image-get-file may be a start, but that seems to return the file object. What I need is the full file name, including the path, in order to find the image's _parent_ directory. I need to create a file name that is in a _sibling_ directory of the image. So how do I get the whole file name? According to the description, the gimp-image-get-name only gets the image's base name (the name inside the directory). RE: script-fu help - Scallact - 03-09-2026 In python, it's possible with the method .get_path() appended to a Gio.File object. Is there a complete doc somewhere, where the GFile format is described? I have no experience with script-fu, and sadly can't help you further. Hope someone can give better advises. RE: script-fu help - rich2005 - 03-09-2026 (03-08-2026, 07:43 PM)egrivel Wrote: Hi, I have a script-fu script I wrote back in 2003, which I use to save the current image in the ../edited folder, and mark the image as "saved". Things change and I have just about given up with both script-fu and python 3 I use possibly a similar script-fu, but using the layer name which is often the same as the file name. [attachment=14301] For what it is worth, the attached script (cut-down a bit from the one I currently use) takes the open image and dumps it to the home folder as a jpeg. There might be enough to get you started converting your old script. RE: script-fu help - teapot - 03-10-2026 Below is a script to print the results of calling the three procedures Scallact listed in post #2. It shows that in scheme gimp turns the returned GFile into a string. Example of the script's printouts: gimp-image-get-file: Is a string: /tmp/test-filenames.xcf gimp-image-get-name: Is a string: test-filenames.xcf gimp-image-get-xcf-file: Is a string: /tmp/test-filenames.xcf Code: #!/usr/bin/env gimp-script-fu-interpreter-3.0RE: script-fu help - egrivel - 03-13-2026 (03-08-2026, 11:52 PM)Scallact Wrote: The procedure browser lists those: I was able to figure it out. It turns out that the "GFile" object returned by gimp-image-get-file is not an object or structure, but simply the filename. I now have the whole script working, and I get the desired result when I run it from the menu. The one last challenge is to assign a keyboard shortcut to it. I used to be able to do this with the dynamic keyboard shortcuts, but that doesn't seem to exist anymore, and the keyboard shortcuts settings don't seem to know about the menu entries created by the script registration. Would anyone know how I can assign my preferred keyboard shortcut (Ctrl+D is what I used) to run it without going into the menu? Thanks, Eric |