(define (script-fu-my-script 
			image 
			layer 
         )
		(let* 
		   (
		   (width (car (gimp-image-width image)))
		   (height (car (gimp-image-height image)))
		   (green-channel 0)            ;will hold our green channel
		   )
			;(gimp-image-undo-disable image); DN = NO UNDO
			(gimp-context-push)
			(gimp-image-undo-group-start image)                   ;undo-group in one step
			
			
			
			;sets the green-channel variable to result of procedure call, all procedures in script-fu returns a list we have to use (car) to get the first item in list returned
			(set! green-channel (car (gimp-channel-new-from-component image GREEN-CHANNEL "Green")))
			
			;insert green-channel into image so that it's part of our image so we can select it
			(gimp-image-insert-channel image green-channel 0 0)
			
			;selects the channel passing the green-channel in as item to select
			(gimp-image-select-item image CHANNEL-OP-REPLACE green-channel)
			
			;copies from from green-channel
			(gimp-edit-copy green-channel)
			
			;define a floating selection and make it the result returned from (gimp-edit-paste) into our active layer
			(define floating-selection (car (gimp-edit-paste layer TRUE)))
			
			;turns our floating selection into a new layer
			(gimp-floating-sel-to-layer floating-selection)
			
			;changes the mode of our floating selection layer
			(gimp-layer-set-mode floating-selection SOFTLIGHT-MODE)
			
			;sets opacity of our floating selection layer
			(gimp-layer-set-opacity floating-selection 40)
			
			
			;BELOW is just to be friendly, we select nothing and removes the added channel to keep our image clean
			
			;we select none
			(gimp-selection-none image)
			
			;removes green-channel from image
			(gimp-image-remove-channel image green-channel)
			
		    ;(gimp-image-undo-enable image) ;DN = NO UNDO
			(gimp-image-undo-group-end image)                     ;undo group in one step
			(gimp-context-pop)
			(gimp-displays-flush)                                 
	    )
	
	
    
) ;end of define
(script-fu-register
  "script-fu-my-script"         ;function name of the function defined above
  "<Image>/Script-Fu/My Test"    ;menu register (where can this script be access from inside GIMP)
  "My Test selects green channel..."       ;description
  "Tin Tran"                          ;author name
  "copyright info and description"         ;copyright info or description
  "2016"                          ;date
  "RGB*, GRAY*"                        ;mode
  SF-IMAGE      "Image" 0                   
  SF-DRAWABLE   "Layer" 0
)

