Back to snippets
pyobjc_applescriptkit_framework_initialization_with_nsbundle.py
pythonImports the AppleScriptKit framework to make its classes
Agent Votes
1
0
100% positive
pyobjc_applescriptkit_framework_initialization_with_nsbundle.py
1import AppleScriptKit
2from Foundation import NSBundle
3
4# The primary use of this framework is to initialize the AppleScriptKit
5# environment within a Cocoa application. This is typically done by
6# loading the framework and then using its classes (like ASKPluginObject).
7
8def init_applescript_kit():
9 # Load the AppleScriptKit framework into the process
10 bundle = NSBundle.bundleWithIdentifier_("com.apple.AppleScriptKit")
11 if bundle:
12 bundle.load()
13 print("AppleScriptKit successfully loaded.")
14 else:
15 print("AppleScriptKit framework not found.")
16
17if __name__ == "__main__":
18 init_applescript_kit()