how can I generate scripting bridge files at runtime? I want to use scripting bridge to quit an appliction, but that application is not known at compile time.
1
votes
2 Answers
4
votes
0
votes
Scripting Bridge is a compile-time technology. You may be able to generate the header at run-time, but what good would that do to your compiled application?
Try with AppleScript:
NSString* script = [NSString stringWithFormat: @"tell application \"%@\" to quit", appName];
NSAppleScript* as = [[[NSAppleScript alloc] initWithSource: script] autorelease];
[as executeAndReturnError: nil];
Given an app name appName, you should be able to send it a quit event quickly and easily.