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

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Load layer from specified folder

#1 User is offline   Sekhmet 

  • Newbie
  • Pip
  • 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
(set! layer (car(gimp-file-load-layer 0
			img
			"text.xcf")))

;Add Layer
(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...)

Thanks in advance for your answers :)
0

#2 User is offline   Roan 

  • Newbie
  • Pip
  • 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.

(set! layer (car(gimp-file-load-layer 0
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

#3 User is offline   Sekhmet 

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

Posted 01 July 2012 - 03:44 PM

Ok, thank you very much for your answer :)
0

#4 User is offline   Sekhmet 

  • Newbie
  • Pip
  • 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

#5 User is offline   RobA 

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

Posted 30 July 2012 - 05:42 PM

View PostSekhmet, 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>
Posted Image
Fantasy Cartography and Mapping by RobA
0

#6 User is offline   ofnuts 

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

Posted 30 July 2012 - 07:20 PM

View PostRobA, on 30 July 2012 - 05:42 PM, said:

View PostSekhmet, 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

#7 User is offline   RobA 

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

Posted 07 August 2012 - 03:05 PM

View Postofnuts, on 30 July 2012 - 07:20 PM, said:

View PostRobA, on 30 July 2012 - 05:42 PM, said:

View PostSekhmet, 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>
Posted Image
Fantasy Cartography and Mapping by RobA
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic