I’m having a problem (the answer to which I’m sure will, as usual, be obvious to everyone but me )
I’ve added the QuickLookUI.Framework and Matt’s .h and .m files, and here’s the relevant bit of my code:
set imagePath to POSIX path of (item i of mfilePaths)
log imagePath
set theSize to {|width|:190, height:190}
log "theSize"
log theSize
set newImage to imageWithPreviewOfFileAtPath_ofSize_asIcon_(imagePath, theSize, YES)
--imageWithPreviewOfFileAtPath:(NSString *)path ofSize:(NSSize)size asIcon:(BOOL)icon
imageView's setImage_(newImage)
I can’t see imageWithPreviewOfFileAtPath_ofSize_asIcon_ anywhere in help, but in that snippet it looks like you’re not actually calling it on anything (except your script itself, by default).
it’s being called through
myTableView2’s setAction_(“table2Clicked”)
which calls the script.
The problem is that I originally just got the thumbnail of the image files I’m working with.
set output to do shell script ("exiftool -b -ThumbnailImage " & quoted form of ((item i of mfilePaths) as text) & " > " & quoted form of (FILE_PATH & "/TMP.JPG"))
set imagePath to (FILE_PATH & "/TMP.JPG")
set newImage to NSImage's alloc()'s initWithContentsOfFile_(imagePath)
imageView's setImage_(newImage)
Bit clunky, but it worked.
Then I discovered that most of the files don’t have a thumbnail (they come from professional photo studios—Canon, Nikon, Hasselblad, sinar etc cameras and software)
So I’m trying the QuickLook stuff.
The instructions for NSImage+Quicklook are:
The error it generates “unrecognized selector sent to object” suggests that I’m not passing the right path, size or BOOL. but I can’t see wherein they are wrong.
No, it’s being called on the wrong object. What you posted says that imageWithPreviewOfFileAtPath_ofSize_asIcon_ is a class method of NSImage, whereas you’re calling it as if its an instance method of your AS class.
So you need to change this:
set newImage to imageWithPreviewOfFileAtPath_ofSize_asIcon_(imagePath, theSize, YES)
into this:
set newImage to current application's NSImage's imageWithPreviewOfFileAtPath_ofSize_asIcon_(imagePath, theSize, YES)