title: Struggling to open a file from an Objective-C path in ApplescriptObjC
body: <p>I am an experienced Cocoa programmer and an Applescript newbie. I need to program a Microsoft-based report generator. I started with the Applescript bridge and basically hit a wall with Word. I am now trying with ApplescriptObjC, and I am struggling like hell.</p>
  
  <p>I am even stuck in the stupid step of opening a file when its path is reported by a method written in Objective-C. The objective-C class code is very simple (as a contrived example):</p>
  
  <pre><code>@implementation Reporter
  - (NSString *)templatePath:(NSString *)fileName
  {
      NSString *fullPath = [self.currentDirectory stringByAppendingPathComponent:fileName];
      return  fullPath;
  }
  @end
  </code></pre>
  
  <p>Side Note: the current directory is not the built app directory.
  Here is one of my tries to use it:</p>
  
  <pre><code>on createReport()
      set my myReporter to Reporter's alloc()'s init()
      set WordApp to the application "Microsoft Word"
      set FinderApp to the application "Finder"
      set theWordTemplatePath to myReporter's templatePath:"Rapport.docx"
      set theWordTemplatePath to theWordTemplatePath as text
      tell FinderApp to open POSIX file theWordTemplatePath
  end createReport
  </code></pre>
  
  <p>This one gets this error:</p>
  
  <pre><code>*** -[CMDAppDelegate applicationWillFinishLaunching:]: Finder got an error: Can’t make «class ocid» id «data optr0000000080B00E0080600000» into type integer. (error -1700)
  </code></pre>
  
  <p>I tried many variations, and despite many hours trying, I still can't have Word open my file.</p>
  
  <p>What am I doing wrong?</p>