;define the main function, i.e. name of the fct. and input parameters
(define (script-fu-pbs-and-slab inFile1 inHeight1 inFile2 inHeight2 ) 

(let* 
	(	;schaffe ein neues, leeres Bild, dazu...
		(imwi 	1445)				;... zuerst die Variablen für Breite...
		(imhi	1112)				;... und Höhe.
		(imim 	(car	(gimp-image-new		;dann das eigentliche Bild als "Variable" erzeugen
				imwi
				imhi
				RGB
				)			
			)
		)
		;jetzt die Ebenen erzeugen, zuerst die proj. BS 
		(pbs					;nenne die Variable(= neue Ebene pbs)
			(car	(gimp-file-load-layer	;lade die entsprechende Datei hoch...
				0			;... im interaktiven Modus...
				imim			;... in das zuvor erzeugte Bild.
				inFile1			;hier wird der Dateipfad übergeben
				)
			)
		)
		;jetzt das gleiche Spektakel für die Slab Bandstruktur
		(slab
			(car	(gimp-file-load-layer
				0
				imim
				inFile2
				)
			)
		)
		(sel-float)
		(scale)
		(legend)
		(title)
		(hspoints)
		(blubb)
       ) ;end of our local variables

(gimp-image-add-layer imim pbs 0)			;füge die erzeugte Ebene pbs dem Bild hinzu
(gimp-image-add-layer imim slab 0)			;füge die erzeugte Ebene slab dem Bild hinzu

(gimp-rect-select imim 0 0 255 900 2 0 0)
(gimp-edit-cut slab)
(set! sel-float (car(gimp-edit-paste slab 0)))
(set! scale (car(gimp-floating-sel-to-layer sel-float)))
(gimp-selection-none imim)

(gimp-rect-select imim 360 0 730 145 2 0 0)
(gimp-edit-cut slab)
(set! sel-float (car(gimp-edit-paste slab 0)))
(set! title (car(gimp-floating-sel-to-layer sel-float)))
(gimp-selection-none imim)

(gimp-rect-select imim 1091 0 380 177 2 0 0)
(gimp-edit-cut slab)
(set! sel-float (car(gimp-edit-paste slab 0)))
(set! legend (car(gimp-floating-sel-to-layer sel-float)))
(gimp-selection-none imim)

(gimp-rect-select imim 252 910 1114 45 2 0 0)
(gimp-edit-cut slab)
(set! sel-float (car(gimp-edit-paste slab 0)))
(set! hspoints (car(gimp-floating-sel-to-layer sel-float)))
(gimp-selection-none imim)

(gimp-rect-select imim 300 300 60 60 2 0 0)
(gimp-edit-cut slab)
(gimp-edit-paste slab FALSE)
(set! blubb (car(gimp-image-get-floating-sel imim)))
(gimp-floating-sel-to-layer blubb)
(plug-in-autocrop-layer 0 imim blubb)

(gimp-layer-scale slab 1245 1113 0 )
(gimp-layer-translate slab -86 -92)
(plug-in-autocrop-layer 0 imim slab)
(plug-in-colortoalpha 1 imim slab '(255 255 255) )


(gimp-display-new imim)					;lasse das Gesamtkunstwerk anzeigen
;(gimp-message inFile1)					;gebe eine Nachricht aus
)
)

;register the script/function in the GIMP database

;1st: call the registration function
(script-fu-register

;2nd: list the 7 obligatory parameters
"script-fu-pbs-and-slab"                        ;func name
"Slab und PBS"                                  ;menu label
"Creates an overlay of the slab bands onto the projected band structure."	;description
"Berti"                             		;author
"copyright 2017, Berti"        			;copyright notice
"August 28, 2017"                          	;date created
""                     				;image type that the script works on

;3rd: add your own parameters that are required by your function
SF-FILENAME	"PBS-file"		"/media/TOSHIBA EXT/Susanne/CeCoIn5/"
SF-VALUE  	"Resolution"	 	"150"	;resolution of the slab pic
SF-FILENAME	"Slab-file"		"/media/TOSHIBA EXT/Susanne/CeCoIn5/"
SF-VALUE  	"Resolution"		"150"	;resolution of the pbs pic
)

;finsh registration by creating a menu entry at the path given below
(script-fu-menu-register "script-fu-pbs-and-slab" "<Image>/File/Create")

;eventual code
;open PBS as layers with particular resolution