Automation from Cocoa (Objective-C) App.

  • Thread starter Robert Tillyard
  • Start date
R

Robert Tillyard

We have a Windows application that loads a Word Document scans the text for
tokens which it then talks to a database on another server to get the values
to substitute. I'm not a Windows person but I think it may be using
something called COM (or OLE or MS Type Library).

Can I do the same on Mac OS X? I have to use Objective-C as this is part of
a much larger application. I've struggled to find any Mac documentation on
doing thins kind of thing.

Thanks, Regards, Rob.
 
P

Phillip M. Jones, CE.T.

Robert said:
We have a Windows application that loads a Word Document scans the text for
tokens which it then talks to a database on another server to get the values
to substitute. I'm not a Windows person but I think it may be using
something called COM (or OLE or MS Type Library).

Can I do the same on Mac OS X? I have to use Objective-C as this is part of
a much larger application. I've struggled to find any Mac documentation on
doing thins kind of thing.

Thanks, Regards, Rob.
of the three items you mention only OLE sounds right.

Its stands for Object Linking and Embedding. That still doesn't answer your
question, other than its likely they are using OLE.

--
---------------------------------------------------------------------------
Phillip M. Jones, CET |MEMBER:VPEA (LIFE) ETA-I, NESDA,ISCET, Sterling
616 Liberty Street |Who's Who. PHONE:276-632-5045, FAX:276-632-0868
Martinsville Va 24112-1809 |[email protected], ICQ11269732, AIM pjonescet
---------------------------------------------------------------------------

If it's "fixed", don't "break it"!

mailto:p[email protected]

<http://www.kimbanet.com/~pjones/default.htm>
<http://home.kimbanet.com/~pjones/birthday/index.htm>
<http://vpea.exis.net>
 
P

Paul Berkowitz

We have a Windows application that loads a Word Document scans the text for
tokens which it then talks to a database on another server to get the values
to substitute. I'm not a Windows person but I think it may be using
something called COM (or OLE or MS Type Library).

Can I do the same on Mac OS X? I have to use Objective-C as this is part of
a much larger application. I've struggled to find any Mac documentation on
doing thins kind of thing.

You won't be able to talk to Word via Objective-C, the main language of
Cocoa. Word is Carbon, not Cocoa. (And its APIs are not available, they're
proprietary, so you wouldn't be able to do much in Word using C++ or C
either.)

There are two higher-level languages available to you: VBA, which is also
operative in Windows and which should (I think) be accessible form straight
VB on Windows. Or AppleScript. If you are accessing just the new Word 2004,
then the AppleScript dictionary is complete and dependable. If you want also
to access earlier Word Mac versions (where the AppleScript dictionary is
corrupt and undependable) you'll have to use 'do Visual Basic' command,
which fundamentally means accessing VBA via AppleScript:

http://word.mvps.org/FAQs/WordMac/WordAppleScript.htm

If you really need to do this from Objective C, you could do it first as
AppleScript (meaning probably 'do Visual Basic') and save the script as a
compiled script or text. Then you can access and run it form Obj-C: check
out NSAppleScript in ApplicationKit.

That's a very roundabout way: Obj-C translating AppleScript translating VBA.
Can't you just do it directly from the Windows app using VBA? (To the best
of my knowledge, which is poor here, VBA is a type of .COM. VBA is a
high-level layer on top of OLE Automation.)

--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top