Snippet parameter (@param snippet)

Created: 2026-07-11 · Updated: 2026-07-11

The snippet parameter type makes the parameter dialog open a snippet picker: a searchable list of existing snippets with a preview image. The script receives a reference to the chosen snippet and can insert it — a typical use is to look up an existing customer logo by name and replace an existing shape with it.

Image snippets as building blocks

@param snippet is most useful with Fragment or Picture snippets (ready-made objects such as logos, icons, signatures). Use subtype= to restrict the picker to those.


Syntax

// @param snippet <name> "<Label>" [subtype="Fragment|Picture|Code"] [category="…"] [tooltip="…"]
  • subtype — restrict the choice to one snippet type (Fragment, Picture or Code). Empty = all.
  • category — restrict to one category (e.g. category="Logos"). Empty = all.
  • default — optionally the Id of a snippet pre-selected when the dialog opens.
  • In the script, Params.GetSnippet("<name>") returns a SnippetRef with Id, Name, TechnicalName, SnippetType, PreviewPath — or null if nothing was chosen.

Insert a snippet

ppptools.InsertSnippet(ref) inserts the chosen Fragment/Picture snippet on the current slide and returns the inserted shape (a group if there are several objects):

// @param snippet Logo "Customer logo" subtype="Fragment" category="Logos" tooltip="Pick a logo from the library"
// @button Insert

var logo = Params.GetSnippet("Logo");
if (logo != null)
{
    var shp = ppptools.InsertSnippet(logo);
    ppptools.CenterOnSlide(shp);
}

The core use case: replace a selected shape (e.g. the old logo) with the chosen snippet. ppptools.ReplaceShape(target, ref, scale, keepName) places the new object at the centre of the original, scales it, and deletes the original.

// @param snippet Logo  "New logo"      subtype="Fragment" category="Logos"
// @param enum    Scale "Scale by"      options="Breite|Höhe|Einpassen|Strecken|Original" default="Breite"
// @param bool    Keep  "Keep name"     default="true"
// @button Replace

var logo   = Params.GetSnippet("Logo");
var target = ppptools.GetSelected();          // the shape to replace

if (logo != null && target != null)
    ppptools.ReplaceShape(target, logo,
        scale:    Params.GetString("Scale"),
        keepName: Params.GetBool("Keep"));

Scale options (values are language-neutral tokens):

Value Effect
Breite scale to the original's width, keep aspect ratio
Höhe scale to the original's height, keep aspect ratio
Einpassen fit into the original's box (largest possible, keep ratio)
Strecken stretch to exact width and height (ratio distorted)
Original leave the snippet's size unchanged

With keep name, the new object takes the original's name — handy when the logo carries a technical name like Kundenlogo and should stay findable/replaceable by name.

Replace all same-named shapes

To swap every occurrence across all slides, iterate via ppptools.GetSlide(i) / ppptools.GetAllShapes(slide) and pass each shape with a matching Name to ReplaceShape. A complete, ready-to-run snippet: Example: replace a snippet by name.