Skip to main content
Engineering LibreTexts

4.6: Launching a Script

  • Page ID
    43811
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Imagine that you want to launch an external configuration tool or that you want to allow one to configure the system or a particular package with the help of a script. In such a case you can declare a launcher. A launcher is shown with a label as a regular setting except that no value is to be entered for it. Instead, a button labelled Launch is integrated in the Settings Browser and clicking on it launch an associated script.

    As an example, to use True Type Fonts, the system must be updated by collecting all the available fonts in the host system. This can be done by evaluating the following expression:

    FreeTypeFontProvider current updateFromSystem
    
    Launchers.
    Figure \(\PageIndex{1}\): Example of launchers.

    It is possible to run this script from the Settings Browser. The corresponding launcher is shown in Figure \(\PageIndex{1}\). The integration of such a launcher is quite simple. You simply have to declare a setting for it! For example, look at how the launcher for the TT fonts is declared:

    GraphicFontSettings class>> standardFontsSettingsOn:
        <systemsettings>
        (aBuilder group: #standardFonts)
            ...
            (aBuilder launcher: #updateFromSystem) ...
                target: FreeTypeFontProvider;
                targetSelector: #current;
                script: #updateFromSystem;
                label: 'Update fonts from system' translated.
    

    Comparing to a simple setting, the only two differences are that:

    • the new setting node is created by sending the launcher: message to the builder and
    • the message script: is sent to the setting node with the selector of the script passed as argument.

    This page titled 4.6: Launching a Script is shared under a CC BY-SA 3.0 license and was authored, remixed, and/or curated by Alexandre Bergel, Damien Cassou, Stéphane Ducasse, Jannik Laval (Square Bracket Associates) via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.