Checking the contents of a clipboard

This is a repost because I posted this in the wrong forum - sorry about this. (If the moderators would be so kind as to remove this, it’d be helpful. EDIT: Took car of it myself - sorry.) :confused:

I am working on a program that consists of a bunch of scripts that get compiled into a RealBasic App that interfaces with Photoshop CS2. I am having a big issue, and am having difficulty implementing a solution.

I have something that is generated on the RB side of things (basically a set of crop marks that gets placed underneath the image I am working on when done) that gets placed into the clipboard. the problem is, sometimes the program doesn’t want to generate said file - hence, when the script that tells the document in Photoshop to paste goes to the clipboard, it hangs.

What I was thinking would be a good solution is to pass a message to RB to let it know whether it suceeded or not - that way, if it doesn’t suceed, the RB side knows to go back, replace/recreate said image on the clipboard, and retry the script again. The problem I have is, I have no clue what I am checking for in terms of how AS would see it!

Hence, the script would be something like this:

Open this Scriplet in your Editor:

If {there is something on the darn clipboard} then
Set RetVal to "True" -- Return Value is set to "True", which when it returns to RB, will see it as it's ok to continue.
-- continue with functions of paste - hardly necessary
else
Set RetVal to "False" -- Return Value is set to "False", telling the RB side to try to resend to the clipboard again.
end if

It’s the {there is something on the darn clipboard} that I need. Thanks.

(What’s sad is that I bet it is something simple!)

The following seems to detect various types of images. The first tests to see if you’ve got a picture in the clipboard in the form of raw data, such as if you copy an image in photoshop. The second looks for record-based pict data, such as that derived from doing a copy on an icon in a finder info window. There is almost always something on the clipboard, and you never know just what it is… so be careful how you ask for it and consider putting it all in a try block so you don’t error out if there’s something unforeseen on the clipboard that your script doesn’t know how to coerce to a valid object.

set cbContent to (the clipboard)
set cbClass to class of (the clipboard)

if ((cbClass is picture) or ((cbClass is record) and (picture of cbContent))) then
	display dialog "Its an image"
else
	display dialog ((cbClass as string) & " (" & cbContent & ")") as string
end if

j