top of page
12. 他のプログラマブルブロックを実行
プログラムから、他のプログラマブルブロックを実行するには、TryRun メソッドを使います。
以下のサンプルのように、コマンドライン引数も渡 すことができます。
public void Main()
{
var otherPB = GridTerminalSystem.GetBlockWithName("Programmable block 2");
if (otherPB.TryRun("Hello")) {
Echo("The other PB was run successfully");
}
}
TryRun メソッドは実行が成功すると true を、何らかの理由で実行に失敗すると false を返します。
bottom of page