Follow

PAL Scripting - Lesson 1 (Hello World!)

This section gives a quick start in getting a PAL or Playlist Automation Language script working. PAL is a fully featured programming language embedded directly into SAM Broadcaster that allows control of almost every aspect of SAM and playlist rotation logic.


Step 1: In SAM Broadcaster go to the menu option Menu->Window->PAL scripts and activate the PAL script window


Step 2: Click on the Add ("+") button. This will open the script options dialog


Step 3: Next to the script source file, click on browse ("folder") button located to the right of the edit field. Enter the name of the script you want to load, or, if the script does not exist, the name of the script to create. For this example, it is "Guide.PAL". Click OK. (If prompted to create the file, select yes)


Step 4: The Guide.PAL script entry will appear inside the PAL Scripts window. Double-click on the Guide.PAL entry to open up the PAL IDE


Step 5: Inside the PAL IDE type the following text:

 

WriteLn('Hello world!');


Step 6: Click on the Run button (or press [F9] )

 

IDE01_-_Hello_World.png

The BLUE line shows which line is being executed, and the output is written on the right hand side of the PAL IDE. (It will show "Hello world!"). The status of the script in the status bar will also be displayed in the PAL IDE.

When running a single line script, you can ignore the semi-colon ";" at the end of the line however, single line scripts are very limited in their usage and we must indicate the ends of the lines for the script to compile and execute.

 

Copy and paste the following in to the IDE and click Run:

WriteLn('Hello world!')
WriteLn('Hello world too!')

 

Ensure you do not add the semi-colons and the IDE will display the error message with the line and column number shown below:

 

";" expected.

 

IDE_-_Compiler_Error01.png

 

You should note that the line number shown is 2 and not 1.  This is because the error has been encountered at Line 2 because the keyword WriteLn is not expected, what the IDE actually reads without the separating semi-colons is this:

 

WriteLn('Hello world!')WriteLn('Hello world too!')

 

If you now add the missing colons to the ends of each line, the script will compile and run successfully.

 

IDE01_-_Hello_World_Too.png

Was this article helpful?
2 out of 2 found this helpful
Have more questions? Submit a request

Comments