getting name of image of button cell (NOT image id)

In a earlier post somewhere, I asked how to set a image in a button cell.
That solved 1/3 of my problems. :confused:

Now i’m wondering how I can get the name of the image in it. :mad: Not something returned like ‘image id 2’. A name.

And how do I get the number of a button clicked in a matrix?

Help would be grealty appreciated. :slight_smile:

Model: G4 Quicksilver
AppleScript: 1.3 Studio
Browser: Firefox 1.5
Operating System: Mac OS X (10.3.9)

An image view does not “retain” a reference to the image currently being displayed in it. This is unnecessary overhead for the object class, as it’s job is to show the image data… not image files… so keeping track of files is not within it’s scope. This is left to you, the programmer, to add to your code. When you use “load image…” to insert an image into the view, ASS does all of the dirty work of generating image data from the file and preparing it for inserting it into the view for you, something you would have to do a bit more explicitly in obj-c. Once you create an image data object and place it into the view, it’s no longer a file… it’s data. So going back and asking it to tell you what the image file that the data came from is not possible.

You’ll have to use a property variable in your code to retain a reference to the file you’re currently viewing, and use that reference when you need to. Whenever you load (or drop) a file into your image view set your variable to the path… name… or both of the image so you can get at it later.

As far as the matrix question goes, try using the “current row” or “current column” property of the matrix to get the index of the clicked cell. Also, see apple’s control view doc for more explanation and properties.

Hope that helps,

Right when I come back to check if anybody replied, someone did!

Anyway, thanks for the tip. So I guess that means i’ll need to make a variable everytime a image is loaded.

And I forgot all about the current row/col property. Thanks for reminding me.

The tip on using current row/col helped a bit, but i’m stuck.

on clicked theObject
	log current row of matrix "buttonbunch" of window "main"
end clicked

That doesn’t work. I’ve also tried many other variations, trying ‘index of current cell’, among others.

I usually can work it out on my own, but this one is too confusing for me.

Sorry if my ‘newbishness’ annoys you pro-applescripters.


	log (get current row of matrix "buttonbunch" of window "main")


on clicked theObject
	set curRow to (current row of matrix "buttonbunch" of window "main")
	log curRow
end clicked