Michael_Lowry

Context detection in AE scripting

Discussion created by Michael_Lowry on Jul 17, 2018
Latest reply on Aug 6, 2018 by PhilippElmer

I recently came up with a way to determine from an AE scripting JOBI or SCRI, whether the scripting statements are being run in the pre-process or process, or the post-process.

 

UC4.DETECT_CONTEXT.JOBI

:SET &DebugMode# = &DebugMode#
:SET &Task_Status# = GET_UC_OBJECT_STATUS()
:IF &Task_Status# < 1573
:  SET &Active_Tab# = "pre-process or process"
:ELSE
:  SET &Active_Tab# = "post-process"
:ENDIF
:IF &DebugMode# = "YES"
:  PRINT "Active tab : &Active_Tab#"
:ENDIF

 

I have started to think of other areas where it could be useful to determine the context within which a script is running.

Context questionAnswer found by
1. If the task is running as a child task in a schedule or workflow, what are the details of the parent task?Predefined variables, e.g.,

&$PROCESSOR#
&$PROCESSOR_RUNID#
&$PROCESSOR_TYPE#

2. Is the task a rerun?&$RESTARTED#
3. If the task was started by another task, what are the details of the calling task?

Predefined read buffer variables, e.g,

UC_CAUSE_NAME & UC_CAUSE_NR

4. If the task was started by an EXEC VARA, which one??
5. If the task was started by an EXEC VARA used in a prompt set:
  • Which prompt set?
  • Which variable?
  • Is the EXEC VARA used in the data source or the default value?
?

 

Can anyone think of ways to obtain this information?

Outcomes