# Gimptalk - Premier Gimp Community: Load layer from specified folder - Gimptalk - Premier Gimp Community

Page 1 of 1

## Load layer from specified folder

### #1Sekhmet

• Newbie
• Group: Members
• Posts: 6
• Joined: 10-June 11

Posted 29 June 2012 - 12:03 PM

Hi everyone,

I'm on the verge of starting the sorting of my holidays' pictures and I'd like to add some infos and a signing in addition to my usual borders.
To not have to do "Open as layers" each and every time, I've "hijacked" the border script and added this
;Open file
img
"text.xcf")))

(gimp-image-add-layer img layer 0)

So far it works but I'd don't know how to specify a path to the file (like "C:\texte.xcf") just so I don't have to copy the xcf to each pictures folder (not that it'd be such a burden but...)

0

### #2Roan

• Newbie
• Group: Members
• Posts: 6
• Joined: 24-June 12

Posted 30 June 2012 - 04:05 PM

If you will always be using the same text.xcf file you can hard code the full path.

img
"C:\texte.xcf"))) ; or whatever the full path is.

If you want to be able to pick the file used when you run the script.

Add a pathvariable like textpath to the functions arguments.

In the script-fu-register function of the script add either:
SF-FILENAME "Path to text file" "C:\text.xcf" ; creates button to the file dialog chooser
or
SF-STRING "Path to text file" "C:\text.xcf" ; simple string input

Using one of the above will give you an extra option in the border scripts start up dialog box.

In the main function add a textpath variable to its arguments.
0

### #3Sekhmet

• Newbie
• Group: Members
• Posts: 6
• Joined: 10-June 11

Posted 01 July 2012 - 03:44 PM

0

### #4Sekhmet

• Newbie
• Group: Members
• Posts: 6
• Joined: 10-June 11

Posted 02 July 2012 - 09:26 AM

Ok, my problem is solved thanks to you

Just a heads-up if someone is looking for the same thing I was, the path needs a double backslash : "C:\\text.xcf"
0

### #5RobA

• Member
• Group: Members
• Posts: 714
• Joined: 05-November 07

Posted 30 July 2012 - 05:42 PM

Sekhmet, on 02 July 2012 - 09:26 AM, said:

Ok, my problem is solved thanks to you

Just a heads-up if someone is looking for the same thing I was, the path needs a double backslash : "C:\\text.xcf"

When running under windows.

-Rob A>

Fantasy Cartography and Mapping by RobA
0

### #6ofnuts

• Moderator GT
• Group: Moderators
• Posts: 1,233
• Joined: 17-October 10
• LocationLooking over your shoulder :)

Posted 30 July 2012 - 07:20 PM

RobA, on 30 July 2012 - 05:42 PM, said:

Sekhmet, on 02 July 2012 - 09:26 AM, said:

Ok, my problem is solved thanks to you

Just a heads-up if someone is looking for the same thing I was, the path needs a double backslash : "C:\\text.xcf"

When running under windows.

-Rob A>
Not really.. the "\\" is because he wanted to use "\" and this should be escaped and this has more to do with Scheme (or C/Python/Java...) syntax for string literals than with Windows. And Windows will happily work with "/" as a filename separator in file specifications ("C:/text.xcf").
010011110110011001101110011101010111010001110011
0

### #7RobA

• Member
• Group: Members
• Posts: 714
• Joined: 05-November 07

Posted 07 August 2012 - 03:05 PM

ofnuts, on 30 July 2012 - 07:20 PM, said:

RobA, on 30 July 2012 - 05:42 PM, said:

Sekhmet, on 02 July 2012 - 09:26 AM, said:

Ok, my problem is solved thanks to you

Just a heads-up if someone is looking for the same thing I was, the path needs a double backslash : "C:\\text.xcf"

When running under windows.

-Rob A>
Not really.. the "\\" is because he wanted to use "\" and this should be escaped and this has more to do with Scheme (or C/Python/Java...) syntax for string literals than with Windows. And Windows will happily work with "/" as a filename separator in file specifications ("C:/text.xcf").

Learn something new every day!

Thanks,

-Rob A>

Fantasy Cartography and Mapping by RobA
0