This example doesn’t do much.
It provides all the required attributes of a layout file, but since the LAYOUTS dictionary is empty, no layout slides will be added from filename.pptx to the config[pptx_output_file], which will result in a rather empty looking PowerPoint presentation.
1 2 3 4 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
|
Here is a slightly more useful example.
This example adds the fourth layout slide (index 3) from filename.pptx as the first master slide, and then adds the second layout slide (index 1) from filename.pptx as the second master slide.
However, since no items are defined, no placeholders on any master slides are updated:
1 2 3 4 5 6 7 8 9 10 11 12 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[3] = {}
LAYOUTS[3]["name"] = "layout_slide_3"
LAYOUTS[3]["add_order"] = 1
LAYOUTS[3]["add_dependency"] = "config"
LAYOUTS[1] = {}
LAYOUTS[1]["name"] = "layout_slide_1"
LAYOUTS[1]["add_order"] = 2
LAYOUTS[1]["add_dependency"] = "config"
|
And now we get a bit more fancy.
This example adds layout slides 5 (index 4), 3 (index 2), and 9 (index 8) from filename.pptx as master slides 3, 1, and 2.
Notice that add_order is completely arbitrary. It’s only used as a priority / sorting mechanism. Though we’re still not updating any items on the slide:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_order"] = 6000
LAYOUTS[4]["add_dependency"] = "config"
LAYOUTS[2] = {}
LAYOUTS[2]["name"] = "layout_slide_2"
LAYOUTS[2]["add_order"] = 1
LAYOUTS[2]["add_dependency"] = "config"
LAYOUTS[8] = {}
LAYOUTS[8]["name"] = "layout_slide_8"
LAYOUTS[8]["add_order"] = 8000
LAYOUTS[8]["add_dependency"] = "config"
|
Up until now, we’ve been using “config” for add_dependency. Think of “config” as a special keyword for “always add this slide”, because “config” is actually a dictionary of results from the main workflow process of Tanium HAT, so it’s always available.
Let’s change the previous example and set layout slide 3 (index 2) to something else like “llama” – aka something that is neither “config” nor a valid plugin name.
Now slide 3 (index 2) will not ever be added:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_order"] = 6000
LAYOUTS[4]["add_dependency"] = "config"
LAYOUTS[2] = {}
LAYOUTS[2]["name"] = "layout_slide_2"
LAYOUTS[2]["add_order"] = 1
LAYOUTS[2]["add_dependency"] = "llama"
LAYOUTS[8] = {}
LAYOUTS[8]["name"] = "layout_slide_8"
LAYOUTS[8]["add_order"] = 8000
LAYOUTS[8]["add_dependency"] = "config"
|
We can also set add_dependency to a name of a valid plugin.
When using the name of a valid plugin, the slide will only be added if that plugin is found by Tanium HAT and enabled by the user.
This example will only add layout slide 3 (index 2) if the “adobe” plugin is enabled:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_order"] = 6000
LAYOUTS[4]["add_dependency"] = "config"
LAYOUTS[2] = {}
LAYOUTS[2]["name"] = "layout_slide_2"
LAYOUTS[2]["add_order"] = 1
LAYOUTS[2]["add_dependency"] = "adobe"
LAYOUTS[8] = {}
LAYOUTS[8]["name"] = "layout_slide_8"
LAYOUTS[8]["add_order"] = 8000
LAYOUTS[8]["add_dependency"] = "config"
|
Let’s bring it back down to basics so we can talk about items.
Let’s say you have 5 layout slides, with the 5th layout slide (index 4) having 20 placeholders on it that can be updated.
Let’s add that slide, and update the 13th item (index 12) on that slide with the text “Hi Mom!”:
1 2 3 4 5 6 7 8 9 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_dependency"] = "config"
LAYOUTS[4]["items"] = {}
LAYOUTS[4]["items"][12] = "Hi Mom!"
|
All text values for items are actually pre-processed by an engine called jinja2
, which is a very powerful templating engine (the specifics of which are way to broad to cover here).
However, there is a very useful custom function called “fetch” that will allow you to pull results in from “config” or from calculations performed by analyze data.
Here’s an example of getting the value of customer_name from config in order to get the final string “This was created for Customer: ABC”:
1 2 3 4 5 6 7 8 9 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_dependency"] = "config"
LAYOUTS[4]["items"] = {}
LAYOUTS[4]["items"][12] = "This was created for Customer: {{ fetch('config', 'customer_name') }}"
|
Here’s an example of getting the value of the analyze data result value for the calculation named “total_installs” from adobe in order to get the final string “Total Number of Adobe Installs: 9001”:
1 2 3 4 5 6 7 8 9 | VERSION = "1.1.0"
MINIMUM_THAT_VERSION = "1.1.0"
PPTX_INPUT_FILE = "filename.pptx"
LAYOUTS = {}
LAYOUTS[4] = {}
LAYOUTS[4]["name"] = "layout_slide_4"
LAYOUTS[4]["add_dependency"] = "adobe"
LAYOUTS[4]["items"] = {}
LAYOUTS[4]["items"][12] = "Total Number of Adobe Installs: {{ fetch('adobe', 'total_installs') }}"
|