Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 376497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:36:17+00:00 2026-05-12T14:36:17+00:00

Using Gimp 2.6.6 for MAC OS X (under X11) as downloaded from gimp.org. I’m

  • 0

Using Gimp 2.6.6 for MAC OS X (under X11) as downloaded from gimp.org.

I’m trying to automate a boring manual process with Script-Fu. I needed to parse the image file name to save off various layers as new files using a suffix on the original file name.

My original attempts went like this but failed because (string-search ...) doesn’t seem to be available under 2.6 (a change to the scripting engine?).

(set! basefilename (substring filename 0 (string-search "." filename))) 

Then I tried to use this information to parse out the base file name using regex but (re-match-nth ...) is not recognized either.

(if (re-match "^(.*)[.]([^.]+)$" filename buffer)
    (set! basefilename (re-match-nth orig-name buffer 1))
    )

And while pulling the value out of the vector ran without error, the resulting value is not considered a string when it is passed into (string-append ...).

(if (re-match "^(.*)[.]([^.]+)$" filename buffer)
    (set! basefilename (vector-ref buffer 1))
    ) 

So I guess my question is, how would I parse out the base file name?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T14:36:17+00:00Added an answer on May 12, 2026 at 2:36 pm

    Context

    GIMP 2.6.6 Windows Vista SP2

    Goal

    Extract the basename of the original filename without its extension.

    Symptom

    Error: eval: unbound variable:
    re-match-nth

    Possible suggestion

    GIMP menu “Filters” > “Script-Fu” > “Console“

    In the input box, paste the following Script-Fu definition of function
    then hit the ENTER key:

    (define (filename-basename orig-name)
        (car (strbreakup orig-name "."))
        ; Nimmzo 09/09/30: the string split function strbreakup is defined 
        ; in the compatibility file from SIOD to TinyScheme:
        ; C:\Program Files\GIMP\share\gimp\2.0\scripts\script-fu-compat.init
    ) ; end  filename-basename
    

    To test the function, enter:

    (filename-basename "screen.xcf")
    

    The Script-Fu Console answers:

    "screen"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running a script-fu macro using GIMP from the command line. However, it
How do I get a list of files (*.jpg) from all folders, using Script-FU
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
I'm using a Mac. When I try creating a png with specific rgb values
I'm using the latest SDL/GFX libs on Fedora 10 and I'm trying to render
I'm trying to read a 16-bit greyscale TIFF file (BitsPerSample=16) using a small C
I'm discovering the gimp API for few days now (using python-fu) and I actually
I'm trying to create a transparent sprite with SDL. I'm using SDL_SetColorKey on a
I am new to gimp programming. I have installed the gimp and using it
Using the http://www.ifans.com/forums/showthread.php?t=132024 post from another question i am allowing the user to enter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.