10.3 Applescript Carbon/Cocoa Clipboard Issue

It would seem that as of 10.3, there is a separate clipboard for Carbon apps and Cocoa apps and that the two clipboards don’t talk anymore.

The code

set dialogResults to “”
copy (display dialog “Some dialog” buttons {“OK”, “Cancel”} default button “OK” default answer “”) to dialogResults
set the clipboard to (text returned of dialogResults)

results in the text appearing on the Cocoa clipboard, paste-able in any Cocoa app.

To Carbon apps like Filemaker or Eudora the clipboard appears to be empty and as a result, will not allow pasting by any method, either via Applescript or Command -V.

This only happens when setting the clipboard via Applescript, manual copy/paste between cocoa and Carbon apps works as expected.

Has anyone else come across this or have a workaround?

thanks,
JW

I have noticed that in Mac OS X 10.2 & 10.3 that you can set the clipboard to something via AppleScript then go to the Finder and Show Clipboard and the clipboard will be empty, but you can still paste whatever was stored via the AppleScript. I wasn’t aware of a Carbon/Cocoa clipboard issue or that there are separate clipboards. Interesting!

Thanks for the reply - I should have noted in my original post that in 10.2, things worked as expected when setting the clipboard via Applescript. I’ve had the chance to check this on a number of 10.2 and 10.3 machines, and for me, the results are consistant.

regards,
JW

Finally found a way around this. I had hunch it had to do with activating the receiving app as I had heard that the global context script problem had been fixed/changed in 10.3.

ie: you can “talk” to your script within the context of a tell statement to another app. In fact it looks like you have to do so.

Getting the syntax for the whole routine of putting up a dialog box and setting the results to the clipboard in a way that resulted in pasteable text everywhere was a trial.

Here’s what worked:

set the result to “”
display dialog “Some Dialog…” buttons {“Cancel”, “OK”} default button 2 default answer “”
if the button returned of the result is “OK” then
set dialogResults to the (text returned of the result)
tell application “FileMaker Developer”
activate
set the clipboard to dialogResults as string
end tell
end if