Lazarus - MS-Word:MAC lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- hde · 2011-07-24 21:29 Hi, I would work on Macintosh and remote access from Lazarus to MS-Word for Mac. Has this already made Somebody of You or can give with tips? hde ---------------------------------------------------------------------- felipemdc · 2011-07-25 08:22 What do you want to achieve exactly? There might be another way which doesnt involve communicating with Word. ---------------------------------------------------------------------- Shebuka · 2011-07-25 08:31 If you are talking about using office automation, then no, there is no office automation component for lazarus. ---------------------------------------------------------------------- felipemdc · 2011-07-25 09:06 Quote from: Shebuka on July 25, 2011, 10:31:29 amIf you are talking about using office automation, then no, there is no office automation component for lazarus. A number of people have already posted in the forum how to connect to MS Office via OLE Automation. But this question is about Mac, so I suppose this method won't work. Also people already posted how to connect to OpenOffice, so your phrase is not correct. ---------------------------------------------------------------------- Shebuka · 2011-07-25 10:38 Quote from: felipemdc on July 25, 2011, 11:06:15 amQuote from: Shebuka on July 25, 2011, 10:31:29 amIf you are talking about using office automation, then no, there is no office automation component for lazarus. A number of people have already posted in the forum how to connect to MS Office via OLE Automation. But this question is about Mac, so I suppose this method won't work. Also people already posted how to connect to OpenOffice, so your phrase is not correct. But he asked about MS-Word for Mac, not OpenOffice. BTW Can you point me to topic about connection to OpenOffice, i'v missed it... ---------------------------------------------------------------------- hde · 2011-07-25 14:17 The connect from Lazarus to MS-Word on Windows is not the problem, it's ok, but i must do the same on MAC OS X. I'm seeking a small office automation with ms-word, open office allone is not enough ---------------------------------------------------------------------- Shebuka · 2011-07-25 14:26 Quote from: hde on July 25, 2011, 04:17:23 pmThe connect from Lazarus to MS-Word on Windows is not the problem, it's ok, but i must do the same on MAC OS X. I'm seeking a small office automation with ms-word, open office allone is not enough We are in 2 seeking for Office Automation for Lazarus Mac OS X version ---------------------------------------------------------------------- Phil · 2011-07-25 14:37 Use Applescript. MS Office apps for Mac have a full Applescript "dictionary" that provides similar functionality to MS Office Automation servers on Windows. To use in your app, place the script commands in a .sh file and then run this script from your app. Here is an example of something I was trying to do about 5 years ago. The Office dictionary I believe has changed since then but it should give you an idea of the scripting possibiilties. osascript -e 'set p to "/users/yourname/desktop/temp.rtf"' -e 'set a to POSIX file p' -e 'tell application "Microsoft Word"' -e 'open a' -e 'front document select' -e 'copy' -e 'close front document' -e 'make new document' -e 'paste' -e 'end tell' At command line, enter this to see syntax of osascript command: man osascript There's also an interactive scripting app included with OS X where you should be able to see the dictionaries of all apps on your machine that can be scripted. Thanks. -Phil ---------------------------------------------------------------------- hde · 2011-07-25 15:48 many thanks, i will try it ---------------------------------------------------------------------- Phil · 2011-07-25 17:05 More information is here, although you won't be able to use the Cocoa NSAppleScript class with your Carbon-based Laz app: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual /ScriptableCocoaApplications/SApps_intro/SAppsIntro.html#//apple_ref/d oc/uid/TP40002164 http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ Foundation/Classes/NSAppleScript_Class/Reference/Reference.html#//appl e_ref/doc/uid/TP40003618 Thanks. -Phil ---------------------------------------------------------------------- felipemdc · 2011-07-26 05:51 Quote from: Phil on July 25, 2011, 07:05:52 pmMore information is here, although you won't be able to use the Cocoa NSAppleScript class with your Carbon-based Laz app: Why not? Carbon and Cocoa can be mixed. If you are using FPC 2.5.1+ you can use Objective Pascal. If you are using FPC 2.4.2 you can use PasCocoa. The Carbon interface comes with PasCocoa inside it because it uses it to implement TTrayIcon. I don't think that the class NSAppleScript is already in PasCocoa, but one could always use it.