getting error when running script through cocoa


I m executing following script in script editor

    tell application "FileMaker Pro"
              open file "TIGER:TestingData.fp7" with passwords "admin" for Accounts "Admin"
    end tell

& it is running successfully.

But when I try to run above code in cocoa using NSApplescript &
NSAppleEventDescriptor class as follows:

NSAppleScript *scriptObject = [[NSAppleScript alloc] initWithSource: @“tell application "FileMaker Pro" open file
"Tiger:TestingData.fp7" with passwords "admin" for Accounts "Admin"”];
NSAppleEventDescriptor *returnDescriptor = [[NSAppleEventDescriptor alloc] init];
returnDescriptor scriptObject executeAndReturnError: &errorDict];
[scriptObject release];

I get descriptorType of returnDescriptor as kAENullEvent & thats why file “TestingData.fp7” doesn’t get open.

What can be the solution?


Hi palav,

since I haven’t installed FMPro on my Powerbook I couldn’t try - but i guess it’s simply that in your above code the applescript part is missing two linefeeds and the ‘end tell’ statement :

NSAppleScript *scriptObject = [[NSAppleScript alloc] initWithSource: 
   @"tell application \"FileMaker Pro\" \nopen file
\"Tiger:TestingData.fp7\" with passwords \"admin\" for Accounts \"Admin\"\nend tell"];
NSAppleEventDescriptor *returnDescriptor = [[NSAppleEventDescriptor alloc] init];
returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
[scriptObject release];


Or simply add the term “to” to the AS string.

But I can’t verify if that is why you’re getting the kAENullEvent returnDescriptor.