I remember seeing a method for distinguishing between Carbon and Cocoa apps from a script. I can’t find it – anyone have a clue?
Hi Adam,
I don’t know, if it’s reliable,
but Carbon apps can have either no package folder or use .rsrc files in Contents/Resources
You can use this:
do shell script "file /Applications/Calculator.app/Contents/MacOS/Calculator"
It will output its architectures so if its mach-o then its cocoa and if its carbon it will say CFM Binary
(The example I used is the calculator which is cocoa. If you want to try a carbon app it would be something like this:)
do shell script "file Microsoft\ Entourage"
which should return as a CFM Binary
Thanks Hendo;
Hayne, the UNIX guru over at OSXhints forum, said this: (http://forums.macosxhints.com/showthread.php?t=77408)
hm.
do shell script "file /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder"
--> Mach-O executable ppc
The Finder is a carbon app
-
What Hayne said. He’s good.
-
This is wrong:
Carbon applications can be Mach-O executables.
- Why do you really need to know?
Hayne asked the same question.
I had a bee in my bonnet that Carbon and Cocoa apps scripted slightly differently. Haven’t decided if that’s true yet.
What do you mean by “scripted differently”? The public API-level implementation of adding scripting support to your application, the internal event handling systems, or something else?
One thing I had noticed was an increasing need to use statements like “set Var to property of (get Object)”, rather than just “set Var to someProperty of someObject”. I wondered if that was an artifact of Cocoa. I have now discovered that one of the apps where this is repeatedly true is Cocoa, but the other is mixed.
Gonna need some more context or examples to address this. I mean, if “someObject” is some variable you’ve created yourself, you’ve “gotten” the object already on your own. What’s the real difference? Examples.
I wasn’t clear M-S. I’m referring to properties of dictionary nouns in some apps. I suspect it has nothing to do with carbon or cocoa, and a lot to do with setting up the AppleScript model.