Hi,
I’m another newbie with moderate AppleScript experience but picked up ASOC a month or so ago.
I have written an app that works and I’m currently dropping files into it with a text Field in IB. I want replace the Text Field with an DropBox/Drop Area of some description.
All I want is the Posix Path of a file or a folder passed back to the delegate
Currently I’ve followed other posts and added an Imagewell to my IB and added a second script to the project and linked up (property parent : class “NSImageView”). The Drag and drop works. If I include a display dialog it returns the POSiX Path.
As I try to set the variable back to the delegate I get a “coercal” error.
“draggingPasteboard]: unrecognized selector sent to object”
Script for the Image well as below:
script Dropzone
property parent : class “NSImageView”
property candidatePath : “”
on draggingEntered_(sender)
set theURL to sender's draggingPasteboard()'s readObjectsForClasses_options_({|NSURL|}, missing value)'s lastObject()
log theURL -- <returns URL
set candidatePath to "" & theURL's |path|()
log candidatePath -- <returns Posix Path
return current application's NSDragOperationCopy
end draggingEntered_
on performDragOperation_(sender)
return true
Dropzone's setItemPath2_(candidatePath) -- This is where the error occurs
end performDragOperation_
end script
I expect this is because I am calling NSImageView and not NSObject? I’ve been banging my head against the wall now for over a week, I bought Shane Stanleys Everyday Applescript yesterday but still struggling so any advice would be really appreciated.
Alternatively a simple Xcode project that contains the delegate and other elements required to perform the task?
Thanks
N