Runsub

The Runsub action icon, a curled piece of paper with two arrows pointing to the right next to it at the top and bottom.

実行された後、Returnactionを使用してメインスクリプトに戻り、その実行を継続するサブスクリプトを呼び出します。サブスクリプトが実行されると、ReturnアクションのReturnValueプロパティに値が格納され、メインスクリプトのRunsubアクションのReturnVariableプロパティにその値が返されます。

このアクションは、小さなスクリプトに分割したい1つ以上の大きなスクリプトがある場合に特に役立ちます。

Dependencies

  • メインスクリプトとサブスクリプトは同じフォルダにある必要があります。

  • たとえば、メインスクリプトが電話スクリプトである場合、サブスクリプトも電話スクリプトである必要があります。たとえば、メインスクリプトが電話スクリプトである場合、サブスクリプトも電話スクリプトである必要があります。
  • メインスクリプトにRunsubアクションを配置する場合、サブスクリプトにはReturnアクションが必要です。
  • Runsubはメインスクリプトから下付き文字に複数の変数を渡すことができますが、下付き文字は(ReturnVariableプロパティの)1つの値のみをメインスクリプトに返すことができます。
  • 下付き文字で定義された変数は、下付き文字が終了すると使用できなくなります。
  • RunScript SpawnRunsub、または同様のスクリプトによって呼び出されるすべてのスクリプトは、有効でアクティブである必要があります。保存プロセス中に、 Studioはアクションによって呼び出されたすべてのスクリプトを検証します。それらのいずれかが無効または非アクティブである場合、 Studioにはエラーが表示され、保存できなくなります。

Supported Script Types

The icon for a Generic script type - a rectangle with < and > symbols inside it.

The icon for the Email script type - a large @ symbol in a diamond.

The icon for the Chat script type - a chat bubble with an ellipsis inside (...), in a diamond shape.

The icon for the Phone script type - an old-style phone handset with curved lines indicating sound coming out of it.

The icon for the Voicemail script type - a symbol that looks like a cassette tape - two circles sitting on a horizontal line.

The icon for the Work Item script type-a piece of paper with one corner folded down and a bullet list on it.

The icon for the SMS script type - a smart phone with a chat bubble coming out of it.

The icon for the Digital script type - a computer monitor with a smartphone next to it.

ジェネリック

Eメール チャット 電話 ボイスメール ワークアイテム SMS デジタル

Comparison of Similar Actions

以下のアクションには同様の機能がありますが、いくつかの重要な相違点があります。

  • RunscriptRunscriptがサブスクリプトをトリガーすると、そこから最初のスクリプトに戻る方法はありません。
  • RunsubRunsubがサブスクリプトをトリガーすると、サブスクリプトにReturnアクションがある限り、スクリプトは最初のスクリプトに戻ることができます。Returnアクションは、添え字が終了したときにRunsubアクションに値を返します。

Input Properties

これらのプロパティは、アクションが実行時に使用するデータを定義します。

プロパティ

説明

を追加

スクリプト内でこのアクションを一意に識別できる、短いフレーズを入力します。アクションアイコンにカーソルを合わせるとキャプションが表示されます。The default is the action name.

ScriptName

生成するスクリプト。アクションのプロパティボックスの上部にあるChoose Scriptリンクをクリックして、事業単位用に保存されているスクリプトを選択できます。

ReturnVariable

メインスクリプトに返される値は、このプロパティに格納されます。複数の値を渡すには、変数として配列を使用します。
Parameters

フィールドの省略記号アイコンをクリックし、渡される生成されたスクリプトに送信する各パラメーター用の変数を追加します。エディターウィンドウに1行につき1つの変数を入力します。意味のある変数名を使用してください。変数名は、生成されたスクリプトで使用されている対応する変数名と一致する必要はありません。

スクリプトに渡されたパラメータは、Beginアクションでそのスクリプトのトレース出力に表示されます。

結果ブランチ条件

結果の分岐条件を使用すると、アクションが実行されたときにさまざまな結果を処理できるように、スクリプトにブランチを作成できます。

状態

説明

Default

スクリプトが他のブランチのいずれかを取る必要がある条件を満たさない限り、パスが取られます。他のブランチが定義されていない場合にも使用されます。

OnError

アクションが正しく実行されなかったときにとられるパス。これは例えば、接続不良、構文エラーなど予期しない問題が発生した場合などです。_ERR変数に1つのアンダースコア文字がある場合、問題の簡潔な説明を入力する必要があります。

Script Example

この例は完全なスクリプトではありません。このアクションを使用するには、追加のスクリプト作業が必要です。

In the main script below (shown top), when the script is triggered, the Runsub action immediately triggers the subscript (shown bottom). In the subscript, Voiceparams sets the Text-to-Speech settings, and the Hours action sets branches for open, closed, and holiday to three different Return actions. When the subscript is finished, the values in the ReturnValues property (in the Return action) are stored in the ReturnVariable field (Runsub action in the main script). The Case action then sets the open, closed, and holiday branches as appropriate.

Main Script

An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

Would you like to download this script?

Subscript

An example script, showing Studio actions with arrows connecting them. Each action has a label beneath it to indicate what the action does in the script.

The three Return actions provide values in the ReturnValue property so the Case action in the main script can determine which branch to follow.

Would you like to download this script?