グローバルオブジェクト
概要
スクリプト方式のエクステンションを実装する場合、次のグローバルオブジェクトに直接アクセスできます。
グローバルオブジェクトはスクリプトエディタで実行するスクリプトでも利用できます。
Python スクリプトの場合
Python スクリプトでも、C# と同様にグローバルオブジェクトに直接アクセスできます。ただし、オブジェクト名は C# の PascalCase ではなく camelCase です。
# C# の App → Python では app
project = app.Workspace.CurrentProject
output.WriteLine("sample", project.Name)
ハンドラ内では、引数の context からも App にアクセスできます。
def my_handler(context: ICommandContext, commandParams: ICommandParams):
app = context.App
output = app.Workspace.Output