What's up with the "duplicate" command not returning a value?

The duplicate command is supposed to return the cloned value(s).

However, as a developer who just made his first scriptable app, I learned that Cocoa Scripting, i.e. Apple’s newer framework for making apps scriptable, seems to have a bug: The “NSCloneCommand” class that’s supposed to be used for automatically handling the duplicate command, fails to return any result.

Which leads to many scriptable apps not having their duplicate command return a result, either. OTOH, older apps not using the Cocoa Scripting framework, do return a result from duplicate.

What’s the verdict on this? This is a known issue, right? And it’s been around for over 10 years, I suppose? Has this ever been a topic with Apple, i.e. have developers contacted Apple about this and gotten a response? I’m puzzled that this has been not addressed for this long. Also, it’s not difficult to fix this. I’ve fixed it in my own scriptable app but wonder if others have written code or an article on how to fix this.

Answering this myself:

Mark Aldritt has confirmed that this is a long-standing issue, which also affects the move and open commands for over 10 years now.

I’ve also found a solution to fixing this in a scriptable application (requires changes to its source code, so you cannot make this work for un-cooperative apps - too bad we cannot easily inject code into apps any more as it used to be possible in the good old days :wink: )

I’ve documented the solution here:http://stackoverflow.com/questions/37239287