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:

InDesign® comet_pdf® Illustrator®

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:

InDesign® Illustrator®

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:

InDesign®

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:

InDesign® comet_pdf® Illustrator®

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:

InDesign® comet_pdf® Illustrator®

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:

InDesign® comet_pdf® Illustrator®

CScript:

system::plugin_path

comet.host.getSessionArgument(option)

Determine the value of an program option or an value of the environment configuration.

The call only returns meaningful values in InDesign® Server.

Parameters:

option (str) –

Valid program option or environment configuration key.

The return type of this function changes depending on the provided key.

The following keys and their return types are supported:

InDesign® Server program options
  • ’-adminport’ | int

  • ’-configuration’ | str

  • ’-console’ | bool

  • ’-noconsole’ | bool

  • ’-errorlist’ | bool

  • ’-noerrorlist’ | bool

  • ’-heartbeatupdateinterval’ | int

  • ’-home’ | str

  • ’-host’ | str

  • ’-iorfile’ | str

  • ’-LogToApplicationEventLog’ | bool

  • ’-maxerrors’ | int

  • ’-maxwaitss’ | int

  • ’-noblockss’ | bool

  • ’-onmainthread’ | bool

  • ’-pluginpath’ | str

  • ’-port’ | int

  • ’-previews’ | bool

  • ’-nopreviews’ | bool

  • ’-rxidletimeout’ | int

  • ’-seh’ | bool

  • ’-sendcrashlogs’ | bool

  • ’-nosendcrashlogs’ | bool

priint:comet option extensions for InDesign® Server
  • ’-cometconfig’ | str

  • ’-cometlog’ | str

  • ’-cometlic’ | str

  • ’-cometcache’ | str

  • ’-cometapilog’ | str

  • ’-cometport’ | int

  • ’-cometaccepttimeout’ | int

  • ’-cometreceivetimeout’ | int

  • ’-cometsendtimeout’ | int

  • ’-cometyield’ | int

  • ’-cometlogrotate’ | int

  • ’-cometthreshold’ | int

  • ’-cometprogress’ | bool

  • ’-cometdrawidle’ | bool

  • ’-cometparanoidredraw’ | bool

  • ’-cometidmlcache’ | bool

  • ’-cometxmlparser’ | int

  • ’-playback’ | int

  • ’-playbackpath’ | str

  • ’-soaplog’ | int

  • ’-debugpy’ | int

Environment settings by app.comet.setEnvironment
  • ’endpoint’ | str

  • ’getEnvironment’ | str

  • ’isConnected’ | bool

  • ’isPubserverConnection’ | bool

  • ’scriptIO’ | str

  • ’upTime’ | int

Raises:

TypeError – When parameter types are invalid

Returns:

The value of the requested session/environment configuration.

Return type:

bool | int | str

Available:

InDesign®

CScript:

server::get_session_arg-

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

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:

InDesign®

CScript:

prefs::import_flattenerstyles