Hi, Kevin - With all due respect, I thought my formatting was a a lot more liberal than most of the sample Script-Fu code I've seen on my last several days with Scheme. Nevertheless, your point was very well taken - and you were 100% correct about the placement of the "set!". The "file-glob" part of the script now works, and I'm successfully able to iterate through my files. Thank you!!!! Unfortunately, it doesn't yet seem to be converting my .png files from RGBA to Indexed: the end files are still RGBA. So I've still got some debugging ahead ;-) In the meantime, I'd definitely appreciate any suggestions/comments on my current indentation style. Thank you again! Sincerely .. PSM ============================================================================ = _____ From: script-fu@xxxxxxxxxxxxxxx [mailto:script-fu@xxxxxxxxxxxxxxx] On Behalf Of Kevin Cozens Sent: Monday, January 09, 2006 9:20 AM To: script-fu@xxxxxxxxxxxxxxx Subject: Re: Script-fu newbie: need to batch-convert files to indexed color paulsm1021 wrote: > The script is below. Any idea what I'm doing wrong????? > > (define (script2-test pattern) > (let* ((filelist (cadr (file-glob pattern 1)))) > (while filelist [snip] > (gimp-image-delete image)) > (set! filelist (cdr filelist)))) I would encourage anyone writing Scheme based scripts to format the scripts like they would format most other scripts or programming language rather. In other words, don't end a line with a massive collection of ). All those closing ) may save space on printouts but makes it much harder to see if you have the right number of them and if they are in the right places. Due to the way you formatted the script you didn't notice that the 'set! filelist' statement at the end of the script is in the wrong place. It should be the last line of the while loop but it is currently after the while. The last two lines should be (gimp-image-delete image) (set! filelist (cdr filelist))))) to use the formatting style of your original script. I haven't tried running the script so there might still be other problems with it. -- Cheers! Kevin. ============================================================================ = ; ; Adapted from: ; - http://www.gimp.org/tutorials/Basic_Batch/ ; - less gimpconvert_pdb.h => ; boolean gimp_image_convert_indexed ; (gint32 image_ID, ; GimpConvertDitherType dither_type, ; GimpConvertPaletteType palette_type, ; gint num_cols, ; gboolean alpha_dither, ; gboolean remove_unused, ; const gchar *palette); ; (define (cvt-to-indexed pattern) (let* ( (filelist (cadr (file-glob pattern 1) ) ) ) (while filelist (let* ( (filename (car filelist) ) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename) ) ) (drawable (car (gimp-image-get-active-layer image) ) ) (gimp-image-convert-indexed image FS-DITHER MAKE-PALETTE 216 FALSE FALSE "Web") ) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image) (set! filelist (cdr filelist) ) ) ) ) ) (script-fu-register "cvt-to-indexed" "cvt-to-indexed" "Convert RGB to Indexed" "" "" "January 8, 2006" "" SF-STRING "pattern" "../../proj/hbaview/data/gimp_scaled/*.png") (script-fu-menu-register "cvt-to-indexed" "<Toolbox>/Xtns/Script-Fu/Utils") [Non-text portions of this message have been removed] Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/script-fu/ <*> To unsubscribe from this group, send an email to: script-fu-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/