comet.host

The comet.host module provides access to the host environment which is running the priint:comet Python API.

The host environment is either InDesign®, Illustrator® or comet_pdf. Several functions are only available for certain host environments since they set or query host preferences.

Methods

comet.host.getType()

Returns the host application the script environment is running in

Returns

The host environment.

One of Host environments

Return type

int

Available

CScript

system::version

comet.host.getVersion()

Returns the major version for the active host software.

The following values can be returned:

  • 15 : InDesign® 2020

  • 16 : InDesign® 2021

  • 17 : InDesign® 2022

  • 24 : Illustrator® 2020

  • 25 : Illustrator® 2021

  • 26 : Illustrator® 2022

Returns

The host version

Return type

int

Available

CScript

system::version

comet.host.getIsServer()

Returns whether the active host is a server (Only true for InDesign® Server)

Returns

Whether the host is a server

Return type

bool

Available

CScript

system::is_server

comet.host.getLanguage()

Get the active language the host software is running in.

The following keys can be returned:

  • 0 : English (US)

  • 1 : English (UK)

  • 2 : German

  • 3 : French

  • 4 : Japanese

  • 5 : Spanish

  • 6 : Portgese

  • 7 : Swedish

  • 8 . Danish

  • 9 : Dutch

  • 10 : Italian

  • 11 : Norwegian

  • 12 : Finnish

  • 13 : Greek

  • 14 : Czeck

  • 15 : Polish

  • 16 : Croatian

  • 17 : Hungarian

  • 18 : Russian

  • 19 : Slowakian

  • 20 : Turkish

  • 21 : Romanian

  • 22 : Bulgarian

  • 23 : Belorussia

  • 24 : Estonian

  • 25 : Latvian

  • 25 : Lithuanian

  • 27 : Slovenian

  • 28 : Ukrainian

  • 29 : Hebrew

  • 30 : Arabic

  • 31 : Korean

  • 32 : Chinese

  • 33 : Chinese (Taiwan)

  • 34 : Tamil

  • 35 : Thai

  • 36 : Vietnamese

  • 37 : Albanian

Returns

The language key

Return type

int

Available

CScript

system::language

comet.host.getApplicationPath()

Determine the path to the host application.

This is the folder to where the host executable is in, e.g. C:/Program Files/Adobe/Adobe InDesign 2021

Returns

The folder of the host application

Return type

str

Available

CScript

system::app_path

comet.host.getPluginPath()

Determine the path to the Plugin subfolder of the host application.

This is the folder where the comet plugin subfolder is in, e.g. C:/Program Files/Adobe/Adobe InDesign 2021/Plug-Ins

Returns

The folder to the plugins

Type

str

Available

CScript

system::plugin_path

comet.host.getPDFProfileNames(source='')

Get a list of all available PDF profiles.

Parameters

source (str) –

  • Empty str: Get the profiles from the host preferences

  • Else: Path to an XML file containing exported PDF profiles

Returns

The PDF profile names

Return type

list[str]

Raises
Available

CScript

prefs::list_pdfstyles

comet.host.exportPDFProfiles(destination, filter=[])

Export available PDF profiles to an XML file.

Parameters
  • destination (str) –

    Full path to the output file.

    Will be overwritten if it exists

  • filter (list[str]) –

    List of profiles to include.

    • Empty list: Export all profiles

Return type

None

Raises
Available

CScript

prefs::export_pdfstyles

comet.host.importPDFProfiles(source, mode=0, filter=[])

Import PDF profiles from an XML file.

Parameters
  • source (str) – Full path to an input file written by exportPDFProfiles()

  • mode (int) –

    Behavior when an imported profile already exists

    • 0: Overwrite

    • 1: Skip

    • 2: Abort

  • filter (list[str]) –

    List of profiles to include during import.

    • Empty list: Import all profiles

Return type

None

Raises
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter str is empty

    • When parameter mode has invalid value

  • CometError – On internal error

Available

CScript

prefs::import_pdfstyles

comet.host.getPrintProfileNames(source='')

Get a list of all available print profiles.

Parameters

source (str) –

  • Empty str: Get the profiles from the host preferences

  • Else: Path to an XML file containing exported print profiles

Returns

The print profile names

Return type

list[str]

Raises
Available

CScript

prefs::list_printstyles

comet.host.exportPrintProfiles(destination, filter=[])

Export available print profiles to an XML file.

Parameters
  • destination (str) –

    Full path to the output file.

    Will be overwritten if it exists

  • filter (list[str]) –

    List of profiles to include.

    • Empty list: Export all profiles

Return type

None

Raises
Available

CScript

prefs::export_printstyles

comet.host.importPrintProfiles(source, mode=0, filter=[])

Import print profiles from an XML file.

Parameters
  • source (str) – Full path to an input file written by exportPrintProfiles()

  • mode (int) –

    Behavior when an imported profile already exists

    • 0: Overwrite

    • 1: Skip

    • 2: Abort

  • filter (list[str]) –

    List of profiles to include during import.

    • Empty list: Import all profiles

Return type

None

Raises
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter str is empty

    • When parameter mode has invalid value

  • CometError – On internal error

Available

CScript

prefs::import_printstyles

comet.host.getFlattenerProfileNames(source='')

Get a list of all available transparency flattener profiles.

Parameters

source (str) –

  • Empty str: Get the profiles from the host preferences

  • Else: Path to an XML file containing exported flattener profiles

Returns

The flattener profile names

Return type

list[str]

Raises
Available

CScript

prefs::list_flattenerstyles

comet.host.exportFlattenerProfiles(destination, filter=[])

Export available transparency flattener profiles to an XML file.

Parameters
  • destination (str) –

    Full path to the output file.

    Will be overwritten if it exists

  • filter (list[str]) –

    List of profiles to include.

    • Empty list: Export all profiles

Return type

None

Raises
Available

CScript

prefs::export_flattenerstyles

comet.host.importFlattenerProfiles(source, mode=0, filter=[])

Import flattener profiles from an XML file.

Parameters
  • source (str) – Full path to an input file written by exportFlattenerProfiles()

  • mode (int) –

    Behavior when an imported profile already exists

    • 0: Overwrite

    • 1: Skip

    • 2: Abort

  • filter (list[str]) –

    List of profiles to include during import.

    • Empty list: Import all profiles

Return type

None

Raises
  • TypeError – When parameter types are invalid

  • ValueError

    • When parameter str is empty

    • When parameter mode has invalid value

  • CometError – On internal error

Available

CScript

prefs::import_flattenerstyles