The Console Function

A console function primarily serves as a debugging tool in the ACF plugin. The ACF plugin includes a function to retrieve the console, which is particularly useful during the compilation process. When compiling using the compile functions, you also receive errors and debug output in the console. The debug level used in those commands determines the amount of data retrieved.

Inserting print statements in your code can greatly aid in debugging and quality checks for ACF functions.

The console function also has the ability to reset the console. This means that you cannot retrieve the same console output twice. You can leverage this function to reset the console before executing a series of ACF function calls, effectively clearing previous console output.

Plugin Function: ACF_GetConsoleOutput

Parameters: There are no parameters required for this function.

Return Value: The return value of this function is the text added to the console, which may include errors and print statements generated by the functions.

Example:

Here's an example of how the console function can be used in a script for compiling plugin functions. The console output is placed into a field on the layout for easy monitoring of the compilation process.


# ------------------------------------------
# Opprettet av: Ole Kristian Ek Hornnes 
# Opprettet dato : 15.10.2018
# Formål:
# ------------------------------------------
Set Variable [ $x; Value:ACF_StartDurationTimer ]
Set Variable [ $res; Value:ACF_Compile( Preferences::Source; 0 ) ] 
Set Variable [ $$compt; Value:ACF_GetDuration_uSec ]
If [ PatternCount ( $res ; "=== START ===" )> 0 ]
      Set Field [ Preferences::ACF_Pack4; $res ]
      Set Field [ Preferences::CompilationErrors; 0 ] 
Else
      Set Field [ Preferences::CompilationErrors; 1 ] 
End If
Set Field [ Preferences::Consolle; ACF_GetConsolleOutput ] 
Set Field [ Preferences::Prototypes; ACF_GetAllPrototypes ]
Commit Records/Requests[ No dialog ]
GotoField[ ][ Select/perform ]