サブルーチンの実行

verb: goSubs

サブルーチンの名前に基づいてサブルーチンの動的リストを実行します。コマンドの実行時に新しいルーチンを追加することができます。

構文

goSubs --routines(List<String>)

入力

スクリプト Designer 必須 AcceptedTypes Description
--routines サブルーチン 必須 リスト<Text> 実行対象となるサブルーチンの名前を含んだリスト。
サブルーチンの作成時にその名前が付与されます。作成プロセスは以下の方法で行われます。
  • 「デザイン」モードでスクリプト・コマンド・ブロックを選択し、右クリックして、「拡張」>「ルーチンの抽出」オプションと進みます。
  • 「デザイン」モードで「表示」>「ルーチン」>「新規ルーチン」メニューでサブルーチンを手動で作成するか、「スクリプト」モードでコマンド「beginSub」の verb を挿入し、命令を挿入して、コマンド「endSub」で終了します。
  • 例 1:「newSubRoutine」というリストに加えて、「subroutineA」および「subroutineB」という 2 つのサブルーチンが作成されます。 このコンテキストでは、コレクションに追加コマンドを使用して「subRoutineA」という名前をリストに追加します。これにより、サブルーチンの実行 コマンドの使用時に、このサブルーチンが実行されます。 「subRoutineA」命令ブロックで、もう一度コレクションに追加コマンドによって「subRoutineB」という名前が「newSubRoutine」リストに追加されます。これにより、「subRoutineB」サブルーチンが、直前に使用したサブルーチンの実行 コマンドによって動的に実行されます。

    defVar --name newSubRoutine --type List --innertype String
    add --collection "${newSubRoutine}" --value subRoutineA
    goSubs --routines ${newSubRoutine}
    beginSub --name subRoutineA
    	add --collection "${newSubRoutine}" --value subRoutineB
    	logMessage --message "Execution of subroutine A started." --type "Info"
    endSub
    beginSub --name subRoutineB
    	logMessage --message "Execution of subroutine B started" --type "Info"
    endSub
    

    例 2: 2 つのサブルーチンの名前 (subRoutineA および subRoutineB) を追加した後、サブルーチンの実行 コマンドでサブルーチンのリストが通知されます。 このサブルーチンの他のコンテキストでは、サブルーチンが実行された現在時刻が示されます。

    defVar --name subRoutinesList --type List --innertype String --value "[subRoutineA,subRoutineB]"
    defVar --name currentDate --type DateTime
    goSubs --routines ${subRoutinesList}
    beginSub --name subRoutineA
       getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
       logMessage --message "Current date of subroutine A: ${currentDate}" --type "Info"
    endSub
    beginSub --name subRoutineB
       getCurrentDateAndTime --localorutc "LocalTime" currentDate=value
       logMessage --message "Current date of subroutine B:${currentDate}" --type "Info"
    endSub
    

    以下も参照してください。

  • 条件に一致する場合サブルーチンを実行