NSTextView and graphics

Hi, i used to make apps in REALbasic and i just switched to the great Applescript Studio.
I’m playing with tutorials and learning the very basics.
But before going further, i would like to know how i can do this:

I have made a window with NSScrollView in it.
I’ve checked the “graphics allowed” checkbox.
So i can run it, write text, paste graphics…

Now,

  1. I want to make a button that will allow me to add a graphic (met’s say a picture of an apple) to this TextView. Each time i will push this button, an apple picture will be added at the insertion point in my text.

  2. I want to “detect” a graphic when i click on it. Is it possible? How can i know i clicked a graphic object and not a character? Can i locate it? How can i know if it is the first, second, or third apple picture of my text?

I hope all this things are possible…
Thanks