Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script-Fu in GIMP 3 website
#1
Hi,

I created a website about Script-Fu in GIMP 3. It explains the tools I use to code, offers tutorials on building libraries, and includes technical references specific to Script-Fu. You can download example plug-ins, such as auto-save and incremental save.

https://script-fu.github.io/funky/
Reply
#2
Created an account just to say *bless you* for sharing the autosave scripts for GIMP 3.0!
Reply
#3
Ahhh! I spoke too soon, I'm in Win11 right now! I'm getting:

Execution error for 'Set Up':
Error: eval: unbound variable: has-attribute?


https://stackoverflow.com/questions/2221...-arguments
..lists 7-8 different people claiming different solutions to the same problem. I don't suppose you have a guide on what to convert to get Script-Fu to work under Windows or both Linux / WIndows?

EDIT: Sorry! I should have specified, this is happening with the Almost-Autosave Setup script.

EDIT 2: I'm a complete idiot, I was getting the above error after I attempted to fix the create folder funciton. (It didn't work). YOUR script(s) (won't create the save folder) are giving me these errors:

Execution error for 'Activate':
Error: Procedure execution of gimp-xcf-save failed: Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf”: No such file or directory

Execution error for procedure 'gimp-xcf-save':
Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf”: No such file or directory

(In Windows, of course) I tried to create the folder for it, but that didn't seem to help at all.
Reply
#4
(04-21-2025, 02:16 AM)crogonint Wrote: Created an account just to say *bless you* for sharing the autosave scripts for GIMP 3.0!

Thank you! did you get it working?

Sorry, I don't use Windows.
Reply
#5
(04-21-2025, 01:39 PM)crogonint Wrote: Ahhh! I spoke too soon, I'm in Win11 right now! I'm getting:

Execution error for 'Set Up':
Error: eval: unbound variable: has-attribute?


https://stackoverflow.com/questions/2221...-arguments
..lists 7-8 different people claiming different solutions to the same problem. I don't suppose you have a guide on what to convert to get Script-Fu to work under Windows or both Linux / WIndows?

EDIT: Sorry! I should have specified, this is happening with the Almost-Autosave Setup script.

EDIT 2: I'm a complete idiot, I was getting the above error after I attempted to fix the create folder funciton. (It didn't work). YOUR script(s) (won't create the save folder) are giving me these errors:

Execution error for 'Activate':
Error: Procedure execution of gimp-xcf-save failed: Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf”: No such file or directory

Execution error for procedure 'gimp-xcf-save':
Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_2.xcf”: No such file or directory

(In Windows, of course) I tried to create the folder for it, but that didn't seem to help at all.

Hi,

Sorry for that, it should be fixed now, I tested in Windows 11.   
https://script-fu.github.io/funky/hub/pl...-autosave/
Reply
#6
Erg..

I had been trying to learn Script-fu to attempt t fix it myself, but that is not going well.
My heart skipped a beat when your link didn't work.
https://script-fu.github.io/funky/hub/pl...-Autosave/
Apparently the link has capital A's now.
I tried testing it, it didn't work for me.
It seems that it cannot create the "Autosave folder on my F drive..?
I created the folder for it.
I renamed it to "GIMP_Autosave".
I checked permissions.
I restarted GIMP to clear any error conditions.
I started GIMP "as Administrator" to see if that would help.

I tried to attach an image for you, but it erased my reply here, so I'm going to post this reply, then try to post the screenshot below...

Yeah, it won't let me attach a screenshot. here is the text of the errors it throws:
GIMP Error
Execution error for procedure 'gimp-xcf-save':
Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf”: No such file or directory

GIMP Error
Execution error for 'Activate':
Error: Procedure execution of gimp-xcf-save failed: Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf”: No such file or directory

UPDATE: I created the GIMP_Autosave folder manuallly, and the Concordia[720x720] folder manually, and it is now saving the autosave files for the test image in the correct folder on the F: drive! Big Grin

Now.. why won't it create those folders for itself??

UPDATE2: I tested with an unamed image and an alpha-only named image, the issue is definitely that it cannot create folders.

I also note that if one image errors out, it does not autosave any of them, but that may be expected behaviour.
I also noted that I don't HAVE to shut down GIMP to clear the error condition, I can just disable autosave, then enable it again. Smile
Reply
#7
(04-29-2025, 06:59 PM)crogonint Wrote: UPDATE: I created the GIMP_Autosave folder manuallly, and the Concordia[720x720] folder manually, and it is now saving the autosave files for the test image in the correct folder on the F: drive! Big Grin

Now.. why won't it create those folders for itself??

Because in the code, creating a directory is always a separate action, if only because different user privileges can be necessary. It is usually not a problem because the code usually has some mkdir() function for this.

But it turns out that script-fu is seriously lacking in the file handling department, and so has no mkdir()
Reply
#8
(Yesterday, 07:10 AM)Ofnuts Wrote: Because in the code, creating a directory is always a separate action, if only because different user privileges can be necessary. It is usually not a problem because the code usually has some mkdir() function for this.

But it turns out that script-fu is seriously lacking in the file handling department, and so has no mkdir()

Interesting.. Could I adjust the script to rename the save files per original file..? Hmm, it sounds like a good exercise, but I wasn't really getting anywhere when I was trying to pick up the gyst of the Script-fu. I'll give it another shot. Wink
Reply
#9
(04-29-2025, 06:59 PM)crogonint Wrote: Erg..

I had been trying to learn Script-fu to attempt t fix it myself, but that is not going well.
My heart skipped a beat when your link didn't work.
https://script-fu.github.io/funky/hub/pl...-Autosave/
Apparently the link has capital A's now.
I tried testing it, it didn't work for me.
It seems that it cannot create the "Autosave folder on my F drive..?
I created the folder for it.
I renamed it to "GIMP_Autosave".
I checked permissions.
I restarted GIMP to clear any error conditions.
I started GIMP "as Administrator" to see if that would help.

I tried to attach an image for you, but it erased my reply here, so I'm going to post this reply, then try to post the screenshot below...

Yeah, it won't let me attach a screenshot. here is the text of the errors it throws:
 GIMP Error
Execution error for procedure 'gimp-xcf-save':
Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf”: No such file or directory

 GIMP Error
Execution error for 'Activate':
Error: Procedure execution of gimp-xcf-save failed: Error creating 'F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf': Error opening file “F:\Images\GIMP_Autosave\Concordia[720x720]\autosave_1.xcf”: No such file or directory

UPDATE: I created the GIMP_Autosave folder manuallly, and the Concordia[720x720] folder manually, and it is now saving the autosave files for the test image in the correct folder on the F: drive! Big Grin

Now.. why won't it create those folders for itself??

UPDATE2: I tested with an unamed image and an alpha-only named image, the issue is definitely that it cannot create folders.

I also note that if one image errors out, it does not autosave any of them, but that may be expected behaviour.
I also noted that I don't HAVE to shut down GIMP to clear the error condition, I can just disable autosave, then enable it again. Smile

Hi,

if you change these two #f to #t in almost-autosave.scm

;; Global Variables
(define debug #f)
(define debug-time #f)

Then you should get more debug output in the error console about what the script is doing, or attempting to do.
It should also attempt to save frequently, helping us to diagnose the issue.

Here in Debian stable, I don't have to create a folder. I point it at a folder that does exits "Location" or leave it blank for Home.
Then the Storage Directory Name, is created automatically in that location.

So I'm as puzzled as you!

This is from my Error Console, after Reset > Factory Reset,  then using Set Up and pointing at a new location on an external drive, storage folder non-existent. It gets to work, creating the folder and making the saves.


> global-aa-set-up : type : boolean : #t
> Parasite not found: global-aa-waiting
> Parasite not found: global-aa-waiting
> global-aa-status : type : boolean : #t
> global-aa-save-every-minutes : type : number : 15
> global-aa-max-saves : type : number : 3
> global-aa-path-set-in-dialog : type : string : /media/mark/DailyBackUp
> global-aa-dir-name : type : string : /test-make-dir
> autosave-settings: list:
(save-every-minutes . 15)
(max-saves . 3)
(dialog-save-path . /media/mark/DailyBackUp)
(dir-name . /test-make-dir)
> Image is untitled
> dialog-save-path : /media/mark/DailyBackUp
> dir-name : /test-make-dir
> image ID : 7
Path root: /media/mark/DailyBackUp/test-make-dir/Untitled
> dialog-save-path : /media/mark/DailyBackUp
> GUI Save Path: /media/mark/DailyBackUp
> dir-name : /test-make-dir
> GUI Folder   : /test-make-dir
> Autosave path: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Constructing autosave filename: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_1.xcf
> Image base name: Untitled
> Autosave path: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Autosave filename: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_1.xcf
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Initial path parts: list:
media
mark
DailyBackUp
test-make-dir
Untitled_7
""
> Creating directory: /media/mark
> Creating directory: /media/mark/DailyBackUp
> Creating directory: /media/mark/DailyBackUp/test-make-dir
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Saving image to: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_1.xcf
> dialog-save-path : /media/mark/DailyBackUp
> dir-name : /test-make-dir
> image ID : 5
Path root: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp
> dialog-save-path : /media/mark/DailyBackUp
> GUI Save Path: /media/mark/DailyBackUp
> dir-name : /test-make-dir
> GUI Folder   : /test-make-dir
> Autosave path: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Constructing autosave filename: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_1.xcf
> Image base name: RS_26_27_Rough_Comp
> Autosave path: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Autosave filename: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_1.xcf
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Initial path parts: list:
media
mark
DailyBackUp
test-make-dir
RS_26_27_Rough_Comp
""
> Creating directory: /media/mark
> Creating directory: /media/mark/DailyBackUp
> Creating directory: /media/mark/DailyBackUp/test-make-dir
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Saving image to: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_1.xcf
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 0 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 2 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 4 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 6 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 8 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 10 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 12 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 14 seconds
> max-saves : 3
> incremented save index: 2
> global-aa-status : type : boolean : #t
> global-aa-save-every-minutes : type : number : 15
> global-aa-max-saves : type : number : 3
> global-aa-path-set-in-dialog : type : string : /media/mark/DailyBackUp
> global-aa-dir-name : type : string : /test-make-dir
> autosave-settings: list:
(save-every-minutes . 15)
(max-saves . 3)
(dialog-save-path . /media/mark/DailyBackUp)
(dir-name . /test-make-dir)
> Image is untitled
> dialog-save-path : /media/mark/DailyBackUp
> dir-name : /test-make-dir
> image ID : 7
Path root: /media/mark/DailyBackUp/test-make-dir/Untitled
> dialog-save-path : /media/mark/DailyBackUp
> GUI Save Path: /media/mark/DailyBackUp
> dir-name : /test-make-dir
> GUI Folder   : /test-make-dir
> Autosave path: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Constructing autosave filename: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_2.xcf
> Image base name: Untitled
> Autosave path: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Autosave filename: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_2.xcf
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Initial path parts: list:
media
mark
DailyBackUp
test-make-dir
Untitled_7
""
> Creating directory: /media/mark
> Creating directory: /media/mark/DailyBackUp
> Creating directory: /media/mark/DailyBackUp/test-make-dir
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7
> Creating directory: /media/mark/DailyBackUp/test-make-dir/Untitled_7/
> Saving image to: /media/mark/DailyBackUp/test-make-dir/Untitled_7/autosave_2.xcf
> dialog-save-path : /media/mark/DailyBackUp
> dir-name : /test-make-dir
> image ID : 5
Path root: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp
> dialog-save-path : /media/mark/DailyBackUp
> GUI Save Path: /media/mark/DailyBackUp
> dir-name : /test-make-dir
> GUI Folder   : /test-make-dir
> Autosave path: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Constructing autosave filename: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_2.xcf
> Image base name: RS_26_27_Rough_Comp
> Autosave path: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Autosave filename: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_2.xcf
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Initial path parts: list:
media
mark
DailyBackUp
test-make-dir
RS_26_27_Rough_Comp
""
> Creating directory: /media/mark
> Creating directory: /media/mark/DailyBackUp
> Creating directory: /media/mark/DailyBackUp/test-make-dir
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp
> Creating directory: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/
> Saving image to: /media/mark/DailyBackUp/test-make-dir/RS_26_27_Rough_Comp/autosave_2.xcf
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 0 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 2 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 4 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 6 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 8 seconds
> global-aa-status : type : boolean : #t
Checking status... Elapsed time: 10 seconds
> global-aa-status : type : boolean : #t
> Parasite not found: global-aa-status
> max-saves : 3
> incremented save index: 3
> Parasite not found: global-aa-stat


(Yesterday, 07:10 AM)Ofnuts Wrote:
(04-29-2025, 06:59 PM)crogonint Wrote: UPDATE: I created the GIMP_Autosave folder manuallly, and the Concordia[720x720] folder manually, and it is now saving the autosave files for the test image in the correct folder on the F: drive! Big Grin

Now.. why won't it create those folders for itself??

Because in the code, creating a directory is always a separate action, if only because different user privileges can be necessary. It is usually not a problem because the code usually has some mkdir() function for this.

But it turns out that script-fu is seriously lacking in the file handling department, and so has no mkdir()

It does! (dir-make)

;; Purpose: Makes a directory in the "home" directory with a string "/path/like/this"
(define (make-dir-path path)
 (let* ((pathParts (cdr (strbreakup path DIR-SEPARATOR)))  ; Skip the empty element ?
        (currentPath (string-append "/" (first-item pathParts)))) ; /home
   (debug-message "Initial path parts: " pathParts)
   ;; Create the rest of the directories step-by-step
   (for-each
    (lambda (part)
      (set! currentPath (string-append currentPath "/" part))
      (debug-message "Creating directory: " currentPath)
      (dir-make currentPath))
    (list-remove-head pathParts))))


Working link

https://script-fu.github.io/funky/hub/pl...-Autosave/
Reply


Forum Jump: