Home › Forums › Macros › ExecuteCaseBranch [value] (feature request) › Reply To: ExecuteCaseBranch [value] (feature request)
11 February 2025 at 23 h 04 min
#7179

Keymaster
OK, there is another way to do this and this is the way I do it ! -)
Inside the matrix, you put this :
// You need to declare the variable in every macro you use it
Declare Once int $externalActionCount$ = 10
// Here is the macro initialization
// Here is a case branch
CaseBranch "My song two"
Post "Begin of the second song"
// inside the casebranch, you can set a global variable that will be used in another macro
$externalActionCount$ = 5
// Here you start the second macro which is loaded in a standart macro slot
MacroStartIfNeededByName "External Action"
// With WaitSignalNotification, the matrix macro will wait the signal from the other macro saying the action is finished
// WaitSignalNotification is optional
WaitSignalNotification ExternalActionIsFinished
Post "Back to Case Branch 2"
EndCaseBranches
In the external macro called “External Action”, you put this code :
// You need to declare the variable in every macro you use it
Declare Once int $externalActionCount$ = 10
Declare int $currentCount$ = 0
// This macro execute an external action and send a signal when it is finnished.
Post "This macro is doing an external action"
DoRepeat
$currentCount$ = {$currentCount$ + 1}
Post {"count " + $currentCount$}
Sleep 30
While {$currentCount$ < $externalActionCount$}
// When the doRepeat loop is finished, the macro send the notification with NotifySignal
// NotifySignal is optionnal
NotifySignal ExternalActionIsFinished