comet.prefs¶
The comet.prefs module provides functions for setting global preferences for the current session
Methods¶
- comet.prefs.getAddW2MLToTemplates()¶
Fetch whether to add w2ml to templates.
- Returns:
Whether the option is turned on
- Return type:
- Raises:
CometError – On internal error
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setAddW2MLToTemplates(enable)¶
Save an W2ML version of every template after creating or changing the templates data file. Using XML or SOAP, simply an W2ML version of the template is generated in the same folder like the template (pageitems/data/NNN.w2ml in most cases). SQL connections using the panelstatement 137 to save the w2ml data. If this statement is empty or missing, update pageitems set dataW2ML = where id = ? is used automatically.
The option is turned off automatically at logout time.
Normally you use your login script (panelstatement 92) to turn on the option.
- Parameters:
enable (bool) – Enable the option?
- Return type:
None
- Raises:
TypeError – When parameter types are invalid
CometError – On internal error
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getAddW2MLToSnippets()¶
Fetch whether to add w2ml to snippets.
- Returns:
Whether the option is turned on
- Return type:
- Raises:
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setAddW2MLToSnippets(enable)¶
Save a W2ML version of every snippet after creating or changing the snippets.
The option is turned off automatically at logout time.
Normally you use your login script (panelstatement 92) to turn on the option.
- Parameters:
enable (bool) – Enable the option?
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getAddMetaDataToTemplates()¶
Fetch whether to metadata to templates.
- Returns:
Whether the option is turned on.
- Return type:
- Raises:
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setAddMetaDataToTemplates(enable)¶
Save Metadata of every template after creating or changing the templates data file. Using XML or SOAP, a zipped folder of the template metadata with file extension meta.zip is generated in the same folder like the template (pageitems/data/NNN.w2ml in most cases).
SQL connections use the panelstatement 146 to save the metadata.
If this statement is empty or missing, update pageitems set metadata = where id = ? is used automatically. For page templates, the statement update pagetemplates set metadata = where id = ? is used
The option is turned off automatically at logout time.
Normally you use your login script (panelstatement 92) to turn on the option.
- Parameters:
enable (bool) – Enable the option?
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
CometError – On internal error.
- See also:
- Available:
InDesign® comet_pdf®
- CScript:
- comet.prefs.getTagsReadable()¶
Get whether Comet placeholders should be read and automatically created when importing TaggedText.
- Returns:
The value.
- Return type:
- Raises:
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setTagsReadable(enable)¶
Set whether Comet placeholders should be read and automatically created when importing TaggedText.
- Parameters:
enable (bool) – The new value.
- Returns:
The old value.
- Return type:
- Raises:
TypeError – When parameter types are invalid.
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getTagsWriteable()¶
Fetch whether write Comet placeholders to tagged text.
- Returns:
Whether the option is turned on.
- Return type:
- Raises:
CometError – On internal error.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setTagsWriteable(enable)¶
Set whether to write Comet place holders to tagged text or not.
InDesign® Ignored while generating
constants.kExportTT
(contains no place holders) andconstants.kExportW2
(contains place holders).- Parameters:
enable (bool) – Enable the option?
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
CometError – On internal error.
- See also:
- Available:
InDesign® comet_pdf®
- CScript:
- comet.prefs.setPanelEnabled(panelID, enabled, message='')¶
Deprecated since version 5.0: Use
panel.setEnabled()
instead.
- comet.prefs.getCScriptBuffer()¶
Get the current size of the CScript buffer in kB.
- Returns:
The buffer size.
- Return type:
- Available:
InDesign® comet_pdf®
- CScript:
- comet.prefs.setCScriptBuffer(buffer)¶
Set the size of the CScript buffer. The changes will take effect from the next script onward. The buffer size is provided in kB and is automatically truncated to the range 1024 - 16384 (1-16 MB).
- comet.prefs.getWebImageTimeout(what=0)¶
Get the timeout for connection to a URL of a web image.
- Parameters:
what (int) –
Which timeout to get.
0: Connection timeout
1: Header timeout
2: Download timeout
- Returns:
The timeout in seconds
- Return type:
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter what has invalid value.
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.setWebImageTimeout(value, what=0)¶
Set the timeout for downloading an URL of a web image.
The internal work for Web Images is done by a software called CURL. There is a default timeout for establishing the connection of 300 seconds. This is a bit long for checking and updating Web Images. We therefore set a default timeout of 3 seconds, which you can be changed using this function.
Alternatively, the timeout for the connection can also be defined by request-timeout in your soapflags.ini.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter what has invalid value.
CometError – On internal error.
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.getWebImageFolder()¶
Get the currently set fallback folder for Web Image downloads.
- Returns:
The fallback folder.
- Return type:
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.setWebImageFolder(path)¶
Set the fallback folder for Web Image downloads.
The path set by this function is only used if panelstatement 141 is empty and is reset at logout time.
- comet.prefs.getWebImageProxy(what=0)¶
Get the current (or soapflags.ini) Proxy settings for web images.
- Parameters:
what (int) –
What proxy data to get.
0: Current proxy settings.
1: Data from soapflags.ini.
- Returns:
A dictionary containing the proxy configuration.
The dictionary contains the following entries:
’activated’:
Value type:
bool
Value: Whether the proxy is activated.
’useSoapFlags’:
Value type:
bool
Value: Whether the proxy is using data from soapflags.ini.
’address’:
Value type:
str
Value: Proxy address.
’port’:
Value type:
int
Value: Proxy port.
’user’:
Value type:
str
Value: Proxy user.
’password’:
Value type:
str
Value: Proxy password.
- Return type:
- Raises:
TypeError – When parameter types are invalid.
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.setWebImageProxy(address='off', port=-1, user='', password='', exceptions=[])¶
Set the proxy for web images.
- Parameters:
address (str) –
Proxy-Address (URL or IP).
- ’default’ or ‘soapflags’
Use settings from soapflags.ini.
Please note that soapflags.ini is read at program start and later changes to the file are ignored!
- ’off’
Deactivate proxy.
- else:
Proxy-Address (URL or IP).
port (int) –
Port for the proxy.
<=0: Don’t explicitly use a port.
user (str) –
Username for the proxy.
Empty str: Login not necessary.
password (str) –
Unencrypted password for the proxy.
Empty str: Login not necessary.
List of exceptions for the proxy.
See here .
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.getUpdateType()¶
Get the placeholder update behavior.
- Returns:
The current update behavior.
- Return type:
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setUpdateType(type)¶
Specify the bevahior for handling or determining placeholder content.
- Parameters:
type (int) –
0: Default behavior. Placeholders are loaded using the current data pool.
- 1: Store data. Placeholders are loaded using the current data pool.
After the data has been inserted into the document, the data is additionally stored in the current data folder:
If the placeholder is a script, the content of the variable gExportValue is used.
On Direct statements (select, get, …) the content of the first column of the first result row is stored.
2: Use update folder.
Please note: The data folder does not have to contain data for all placeholders. But if it contains data for one placeholder, data for all products must be there.
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter type has invalid value.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getUpdatePath()¶
Get the current folder for loading locally stored placeholder content.
- Returns:
The full path to the update folder.
- Return type:
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setUpdatePath(path)¶
Set the folder for loading stored placeholder content from.
The folder is only used when update type 2 (‘Use data’) is active.
- comet.prefs.getDocWatch()¶
Fetch the current document watch state.
- Returns:
The document watch state.
- Return type:
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.setDocWatch(state)¶
Enable/disable the document watch. When document watch is enabled, the system attempts to load and execute the document watch panel statements.
Document watch is automatically disabled when the data connection is disconnected (database logout, SOAP logout, change XML folder).
The call should be made in the login script of the data connection.
- comet.prefs.getMagnetState()¶
Ascertain for which situations magnets are currently activated.
- Returns:
The active situations as bit flags.
Sum of Magnet situations
- Return type:
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setMagnetState(situation, state)¶
Disable or enable magnets for certain situations. On program start all situations are enabled.
Disabling individual situations should only ever be used for a short time and should be reversed as soon as possible.
- Parameters:
situation (int) –
For which situation to change the magnet state.
Sum of Magnet situations
state (int) –
Which state to set for the provided situations.
One of Magnet states
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter state has invalid value.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getLayoutRulesState()¶
Ascertain the state of the currently active layout rule situations.
- Returns:
A bit flag value indicating which situations are active.
Can be bitwise checked against values of Layout rule situations
- Return type:
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setLayoutRulesState(situation, state)¶
Enable/disable certain layout rule situations.
This setting is global and is active until the next call to this function or until the currently active data connection is changed.
You should take strict care to turn layout rules that you have turned off back on. Otherwise, the building and updating of your documents may no longer be executed correctly.
- Parameters:
situation (int) –
The situations to set the new value for.
Sum of Layout rule situations
state (bool) – The new state of the situations.
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getLayoutRuleState(ruleID)¶
Determine whether a single layout rule is suppressed from execution.
- comet.prefs.setLayoutRuleState(ruleID, state)¶
Set whether a single layout rule should be suppressed from execution.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
- Available:
InDesign® comet_pdf® Illustrator®
- See also:
- CScript:
- comet.prefs.getSnippetMatch()¶
Get the standard snippet match criteria.
The value is reset automatically at logout time.
Usually, this value is set in a login script (panelstatement 92).
- Returns:
Arbitrary combination of snippet match criteria.
Sum of Snippet match settings
- Return type:
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setSnippetMatch(value)¶
Get the standard snippet match criteria.
The value is reset automatically at logout time.
Usually, this value is set in a login script (panelstatement 92).
- Parameters:
value (int) –
Arbitrary combination of snippet match criteria.
Sum of Snippet match settings
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter value is < 0.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getLogState(what=1)¶
Get the state of writing additional log information.
- Parameters:
what (int) –
Which additional log information state to query.
1: Get state for log information about inserting TaggedText
2: Single steps of frame fitting
- Returns:
The logging state.
- what == 1:
0: Disabled
1: Enabled
2: Write line delimiters as
\n
and\r
- what == 2:
0: Disabled
1: Enabled
- Return type:
- Raises:
TypeError – When parameter types are invalid.
ValueError – When parameter what has invalid value.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.setLogState(what=1, how=1)¶
Set the state of writing additional log information.
InDesign® With the menu command Plug-Ins -> Comet -> More Log Output you can switch on and off all additional log outputs.
Additional log messages should only be activated for a short time. Writing the messages can take a long time and significantly reduce performance. Very large log files may be involved.
If additional log messages are written, confidential customer data can be written to the log file!
The additional log messages are automatically switched off again after restarting the host application.
- Parameters:
- Return type:
None
- Raises:
TypeError – When parameter types are invalid.
When parameter what has invalid value.
When parameter how has invalid value.
- Available:
InDesign® comet_pdf®
- See also:
- CScript:
- comet.prefs.getShowURLProgress()¶
Determine whether a progress bar should be shown for Web image downloads.
The setting has no meaning for the manual creation and updating of web images via the Web Images panel or the Web Images context menu.
- Returns:
Whether the progress bar is shown on download.
- Return type:
- Available:
InDesign®
- CScript: