Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

erudit

macrumors newbie
Original poster
Nov 13, 2019
1
0
Hello,

I have a task to open Microsoft Word and create a new document in Objective C.

If I am running an Apple Script below in the Script Editor, it works fine and a new Microsoft Word document gets created:

tell application "Microsoft Word" to make new document"

BUT, if I am trying to call the same script from Objective-C code (see it below), it only opens the Microsoft Word application, but does not create a new document :

NSDictionary* errorDict;
NSAppleScript * appleScript = [[NSAppleScript alloc] initWithSource:

@"tell application \"Microsoft Word\" to make new document"];

[appleScript executeAndReturnError:&errorDict];

I guess there is something to do with the permissions.

Any ideas are very welcome!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.