0

I'm trying to use Scripting Bridge in my Mac OS app and am having difficulty implementing it. I've included the framework, and am intending to use it with Finder, so I've included a Finder.h file in my application as well.

I.E

#import <ScriptingBridge/ScriptingBridge.h>
#import "Finder.h"

However, whenever I call:

FinderApplication *finder = [SBApplication applicationWithBundleIdentifier:@"com.apple.Finder"];

I get the error

'FinderApplication' undeclared (first use in this function)

Are there any other things I need to do in order to get it working?

Thanks.

minimalpop
  • 6,997
  • 13
  • 68
  • 80

1 Answers1

5

How did you generate the Finder.h file? I assume you used sdef like this:

#!/bin/sh
sdef /System/Library/CoreServices/Finder.app| sdp -fh --basename Finder

If so, your code is similar to what I'm using successfully in my apps.

sbooth
  • 16,646
  • 2
  • 55
  • 81
  • Thanks, I was using an older Finder.h file and the code you offered seemed to do the trick! – minimalpop Mar 21 '11 at 03:03
  • So you mean we have to generate .h file by ourselves. So is there a chance that a file generated will be different from other people. Will it cause a problem if I use this generated h file to run on other computers? – Chanok Jun 02 '11 at 13:51
  • There is that chance, but I think problems will only occur if the app's sdef removes or renames some of the AppleScript terminology. In that case, if your user had a newer version of the app then your SB interface might fail. I wouldn't worry about the Finder, though. – sbooth Jun 02 '11 at 19:56
  • Use the sdef command alone in Terminal, or together with the #! if you create a custom build phase in Xcode. – sbooth May 10 '13 at 12:04