current image on image well


how can i check the value of current image on image well?? i want to check this with if statement.

pls help.

What do you mean by the value of the current image?

thanks for reply.

i will explain.

i have one window two button “1” and “2” and image well. image on image well changes when i press button. i have one more button that is “check”. if i press this button and there is a image by name of “image 1” then it should display dialog “image one” else “image two”

i have written this script but its not working

on push_(sender)

set currentImage to current application’s NSImage’s imageNamed()

if (currentImage = “image1”) then

display dialog “image one”


display dialog “image two”

end if

This will not do what you want to do. You need to get the name of the image that is in your image view, so you need to use a method that asks the image view for its image’s name. You can do that with the following code (assuming that your image view is called “imageView” and you loaded your pictures using the imageNamed: method):

on push_(sender)
		set currentImage to imageView's |image|()'s |name|()
		if currentImage as text is "image1" then
			display dialog "image 1"
			display dialog "image 2"
		end if
	end push_

I would strongly suggest that you buy Shane’s book, “ApplescriptObjC Explored”, and study it.


thank you ric.

i will definitely buy that book.

thanks a ton…