System information

You will find a general example for the use of system here.

Version :
16.10.2024, 11:40 Uhr

System informationThis module is used to get information about the current system settings such as date format, currency etc.

static char* login(char* s)

Login name of the user. The login name is the name under which the user has logged onto a computer, not the name which with the user may have logged on to a database.

Name Type Default Description
Return String or char*   (Depends on parameter s) User name, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::login(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* host(char* s)

Host name of the computer.

Name Type Default Description
Return String or char*   (Depends on parameter s) Host name, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::host(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* getenv(char* s, char* vname)

Value of the global sytem variables. With Mac OS X upon logging in onto computer these variables are read from from the file ~/.MacOSX/environment.plist and can be expanded by applications. Some variable are set by the system.

Name Type Default Description
Return String or char*   (Depends on parameter s) Current value of the searched system variable, same as parameter s
s String or char* - Reserved memory for the result
vname String or char* - Name of the searched variable
int main()
{
    char	*s = alloc(1000);
showmessage(system::getenv(s, "PATH"));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* currency(char* s)

Mac OS X only With Mac OS X the currency is set in
System settings:country settings:Format:Numbers
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Currency symbol, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::currency(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* AM(char* s)

Time symbol for before noon. With Mac OS X this setting is made in
System settings:country settings:Format:Time:Before noon
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Time symbol for before noon, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::AM(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* PM(char* s)

Time symbol for the afternoon. With Mac OS X this setting is made in
System settings:country settings:Format:Time:Afternoon
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Time symbol for afternoon, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::PM(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* decimal_sep(char* s)

Decimal separator (comma sign). With Mac OS X this setting is made in
System settings:country settings:Format:Numbers
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Decimal point, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(10);
showmessage(system::decimal_sep(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* thousand_sep(char* s)

Separator between thousands, for example 100.000. With Mac OS X this setting is made in
System settings:country settings:Format:Numbers
gemacht.

Name Type Default Description
Return String or char*   (Depends on parameter s) Time information, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(10);
showmessage(system::thousand_sep(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* date_sep(char* s)

Mac OS X only Separator between day, month and year in the abbreviated date format. With Mac OS X this setting is made in
System settings:country settings:Format:Date
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Date separator, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(10);
showmessage(system::date_sep(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* time_sep(char* s)

Mac OS X only Separator between hours, minutes and seconds. With Mac OS X this setting is made in
System settings:country settings:Format:Time
.

Name Type Default Description
Return String or char*   (Depends on parameter s) Time separator, same as parameter s
s String or char* - Reserved memory for the result
int main()
{
    char	*s = alloc(10);
showmessage(system::time_sep(s));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int time_diff(
  char* dt1,
  char* dt2,
  int fmt)

Time difference in seconds. See system::now for supported date time formats.

Name Type Default Description
Return int   Difference between the two date times in seconds
dt1, dt2 String or char*, String or char* - Two date time strings.
fmt int - In what format are the two times given?< All system independent formats from system::now are allowed as formats.
#include "internal/types.h"

A timer should change the state of a multistate. The function time_diff is used here to calculate the timers run time.

#include "internal/types.h"
#include "internal/text.h"
int gMaxLen = 1140;
int main () { char dt [512]; char now [512]; char str [512]; int sec = 0; int states = multistate::count_states (gFrame); int state = multistate::get_active_state (gFrame);
system::now (now, ddmmyyyy_hhmmss); timer::get_start (gFrame, "green-red", dt); sec = (system::time_diff (now, dt, ddmmyyyy_hhmmss));
if (sec >=>= gMaxLen) { multistate::set_active_state (gFrame, states-1); timer::stop (gFrame, "green-red"); return 0; }
state = (states * sec) / gMaxLen; multistate::set_active_state (gFrame, state);
return 0; }

v3.3 R2670, 17.10.2011
Parameter fmt since v4.1.6 R26621

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

now

static int time_scan(
  char* dt1,
  int fmt,
  int* year = 0,
  int* month = 0,
  int* day = 0,
  int* hour = 0,
  int* minutes = 0,
  int* seconds = 0,
  int* milliseconds = 0)

Determines the partial values of a date-time string.

Name Type Default Description
Return int   0 or ErrorCode
dt1 String oder char* - Valid datetime string
fmt int - Format of the give datetime string. As formats all system independent representations from system::now are allowed.
year int* 0 Year

0 : Ignore
month int* 0 Moth (1-12)

0 : Ignore
day int* 0 Day

0 : Ignore
hours int* 0 Hours

0 : Ignore
minutes int* 0 Minutes

0 : Ignore
seconds int* 0 Seconds

0 : Ignore
millisecoonds int* 0 Millseconds

0 : Ignore
#include "internal/types.h"

v4.1.7 R26836, 21. Apr 2020

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* email(char* s)

DEPRECATED! Standard email address of the user. With Mac OS X this setting is usually made in the standard email program.

Name Type Default Description
Return char*   Email address of the user
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::email(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* account(char* s)

Standard email account of the user. DEPRECATED! Standard email account of the user. With Mac OS X this setting is usually made in the standard email program.

Name Type Default Description
Return char*   User's standard email account
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::account(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* organization(char* s)

DEPRECATED! Standard company information of the user. With Mac OS X this setting is usually made in the standard email program.

Name Type Default Description
Return char*   User's standard organization
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::organization(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* realname(char* s)

DEPRECATED! Actual name of the user as specified in the user administration.

Name Type Default Description
Return char*   Actual user name
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::realname(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* signature(char* s)

DEPRECATED! User signature. With Mac OS X this setting is usually made in the standard email program.

Name Type Default Description
Return char*   User signature
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::signature(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* homepage(char* s)

DEPRECATED! Standard homepage of the user

Name Type Default Description
Return char*   Homepage of the user
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::homepage(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* download(char* s)

DEPRECATED! Standard download folder of the user

Name Type Default Description
Return char*   User download folder
s char* - Reserved memory for the result
int main()
{
    char	*s = alloc(1000);
showmessage(system::download(s));
release(s);
return 0; }

This function is not supported anymore!

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* tcpip(char* s, int ix = 0)

Current TCP/IP address of the computer

Name Type Default Description
Return String or char*   (Depends on parameter s) TCP/IP Address, same as parameter s
0.0.0.0 in case of an error
s String or char* - Reserved memory for the result
ix int 0 0-based index of address to retreive, only supported on Windows
int main()
{
    char	*s = alloc(1000);
showmessage(system::tcpip(s, 0));
release(s);
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* macid(char* s, int ix = 0)

Get MacIDs of the computer.

Name Type Default Description
Return String or char*   (Depends on parameter s) MacID, same as parameter s
"" in case of an error
s String or char* - Reserved memory for the result
ix int 0 0-based index of hardware
int main()
{
    char	*s = alloc(1000);
showmessage(system::macid(s, 0));
release(s);
return 0; }

v3.4 R5322, 20. Mai 2014

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* session_id(char* s)

SessionID of the current PubServer connection.

Name Type Default Description
Return String or char*   (Depends on parameter s) SessionID of the current PubServer connection.
"" : No active PubServer connection
s String or char* - Reserved memory for the result

v4.1.8 R27723, 16. Nov 2020

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

<sessionId>
comet.datapool.getSessionID

static int pid()

Get the unique process id of the application (InDesign®, InDesign® Server, comet_pdf).

Name Type Default Description
Return int   pid of executing application

v4.0.5 R19555, 12. Jul 2017

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int shiftkey()

Is the Shift button currently being pressed?

Name Type Default Description
Return int   0 no
1 yes

Simply release it!

int main()
{
    while (system::shiftkey ()) {}
    showmessage("aaaaah!");
return 0; }


priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

altkey
cmdkey
controlkey
comet.isShiftKeyPressed

static int altkey()

Is the Alt button currently being pressed?

Name Type Default Description
Return int   0 no
1 yes

Version 2.1 R1830, 1. April 2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

shiftkey
cmdkey
controlkey
comet.isAltKeyPressed

static int cmdkey()

Is the Command button currently being pressed?

Name Type Default Description
Return int   0 no
1 yes

Version 2.1 R1830, 1. April 2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

shiftkey
altkey
controlkey

static int controlkey()

Is the Control button currently being pressed?

Name Type Default Description
Return int   0 no
1 yes

Version 2.1 R1830, 1. April 2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

shiftkey
altkey
cmdkey
comet.isCtrlKeyPressed

static char* now(char* str, int td = kShortDateTime)

Get the current system time.

The following table contains a complete list of all supported output formats
FormatstringMacWindows
kShortDate 04.09.20094.9.2009
kLongDate 4. September 20094.9.2009
kAbbrevDate 04.09.20094.9.2009
kShortTime 08:0208:02:54
kLongTime 08:02:5408:02:54
kShortDateTime 04.09.2009 08:024.9.2009 08:02:54
kLongDateTime 4. September 2009 08:024.9.2009 08:02:54
kAbbrevDateTime 04.09.2009 08:024.9.2009 08:02:54
kShortDateLongTime 04.09.2009 08:02:544.9.2009 08:02:54
kLongDateLongTime 4. September 2009 08:02:544.9.2009 08:02:54
kAbbrevDateLongTime 04.09.2009 08:02:544.9.2009 08:02:54
SSystem independent formats
ddmmyyyy 04.09.2009
ddmmyyyy_hhmm 04.09.2009 08:02
ddmmyyyy_hhmmss 04.09.2009 08:02:54
dmyy 4.9.09
hhmm 08:02
hhmmss 08:02:54
hmm 8:02
hmmss 8:02:54
since v4.1 R23901
yyyymmddhhmmss 20181022114501
xmldatetime 2018-10-22T11:45:01
iso_time_colon 11:45:01
iso_time_hyphen 11-45-01
iso_date 2018-10-22
iso_date_time_colon 2018-10-22 11:45:01
iso_date_time_hyphen 2018-10-22 11-45-01

Name Type Default Description
Return String, char* or int  
  • td == 111 : int, Microseconds since 1. Jan. 1970
  • td == 112 : int,Microseconds since programm start
  • sonst : The pointer td is returned as the result and contains the requested datetime
td String or char* - Reserved memory for the result

With td == 111 and td == 112 the parameter is ignored and may be 0.
tp int kShortDateTime Format specification

System depended
kShortDate (= 0)
kLongDate (= 1)
kAbbrevDate (= 2)
kShortTime (= 20)
kLongTime (= 36)
kShortDateTime (= 16)
kLongDateTime (= 17)
kAbbrevDateTime (= 18)
kShortDateLongTime (= 32)
kLongDateLongTime (= 33)
kAbbrevDateLongTime (= 34)
system independend
ddmmyyyy (= 96)
ddmmyyyy_hhmm (= 97)
ddmmyyyy_hhmmss (= 98)
dmyy (= 99)
hhmm (= 100)
hhmmss (= 101)
hmm (= 102)
hmmss (= 103)

since v4.1 R23901
yyyymmddhhmmss (= 104)
xmldatetime (= 105)
iso_time_colon (= 106)
iso_time_hyphen (= 107)
iso_date (= 108)
iso_date_time_colon (= 109)
iso_date_time_hyphen (= 110)

ab v4.1.6 R25678
111: Microseconds since 1. Jan. 1970, Return value is of type int
112: Microseconds since programm start, Return value is of type int
#include "internal/types.h"
#include "internal/types.h"
int main() { char dt [256]
showmessage ("%s", system::now(dt, ddmmyyyy_hhmm)); showmessage ("%d μsec", system::now(0, 112));
return 0; }

Test of system::now and system::time_diff. Take care, time_diff expects strings (char* or string) as input normally, but together with formats 111 and 112 it returns int-numbers and you do not need the time_diff function here. The output should be 2000NNN and 2.

#include "internal/types.h"
int main() { int sec; int startTime, endTime; char startTimeStr [256], endTimeStr [256];
startTime = system::now(0, 111); system::now(startTimeStr, yyyymmddhhmmss);
system::sleep (2000); // 2 seconds
endTime = system::now(0, 111); system::now(endTimeStr, yyyymmddhhmmss);
showmessage("Mikroseconds\t: %d\nSeconds\t: %d",   endTime - startTime,   system::time_diff (endTimeStr, startTimeStr, yyyymmddhhmmss));
return 0; }

Version 1.1.6
Formates 111 and 112 since v4.1.6 R25678

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int os()

Under what operating system is a script currently run. This function requires the Include #include "internal/types.h".

Name Type Default Description
Return int   kMacOS (= 1)
kWindows (= 2)
kLinux (= 3)
#include "internal/types.h"
int main()
{
    if (system::os() == 1)	showmessage("You're using a Macintosh.");
    else					showmessage("You're using Windows.");
return 0; }

Version 1.1.6

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int is_server()

You are currently run InDesign® Server or not?

Name Type Default Description
Return int   1 : InDesign® Server
0 : InDesign®
int main()
{
    if (system::is_server() == 1)	showmessage("You're using InDesign® Server.");
    else							showmessage("You're using InDesign® (Desktop).");
return 0; }

Version 3.0, 8. April 2009

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* app_path(char* path)

Get the current path of InDesign®.

Name Type Default Description
Return String or char*   (Depends on parameter path) Path of the InDesign® program, same as parameter path.
path String or char* - Reserved memory for the result.
int main()
{
    char	*path = alloc(4068);
showmessage(system::app_path(path));
release(path);
return 0; }

Version 1.1.7, Januar 2005

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

xmlquery::app_path

static char* plugin_path(char* path)

Get the current plugin folder.

Name Type Default Description
Return String or char*   (Depends on parameter path) Plugin folder, same as parameter path.
path String or char* - Reserved memory for the result.
int main()
{
    char	*path = alloc(4068);
showmessage(system::plugin_path(path));
release(path);
return 0; }

Version 1.1.7, January 2005

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* crypt(char* str, char* crpt)

Encrypt a text. This command is only implemented for employees and staff of Werk II.

Name Type Default Description
Return String or char*   (Depends on parameter crpt) Encrypted string, same as parameter crpt
str String or char* - String that is to be encrypted.
crpt String or char* - Reserved memory for the result. When using char* as the parameter type, the result string must be at least 256 bytes larger than the result.

The examples shows the encryption and decryption of a string.

int main()
{
    char	*str	= alloc(1000);
    char	*crpt	= alloc(1000);
    char	*dcrpt	= alloc(1000);
strcpy (str, "abc-äöü-ß"); system::crypt(str, crpt); system::decrypt(crpt, dcrpt); showmessage("Ursprung\t%sVerschlüsselt\t%s\nEntschlüsselt\t%s", str, crpt, dcrpt);
release(str); release(crpt); release(dcrpt);
return 0; }

Version 1.1.7, January 2005

priint:comet InDesign® Plug-Ins, comet_pdf

system::decrypt
xml::export_placeholder
xml::export_action

static char* decrypt(char* crpt, char* str)

Decrypt a encrypted string. This command is only implemented for employees and staff of Werk II

Name Type Default Description
Return String or char*   (Depends on parameter str) unencrypted string, same as parameter str
crpt String or char* - encrypted string.
str String or char* - Reserved memory for the result.

Version 1.1.7, Januar 2005

priint:comet InDesign® Plug-Ins, comet_pdf

system::crypt
xml::export_placeholder
xml::export_action

static int oem(char* type, char* label)

Customize the labels of the About dialogs.

To customize the company logos please contact our support team.

Name Type Default Description
Return int   0 or ErrorCode
type String or char* - Which label is to be changed?

"address" : Change the address information in the order and the About dialogs.
"company" : Change the company name shonw in the dialogs of the trial period, (seit R 250).
"contacts" : Change the contact information shonw in the dialogs of the trial period, (seit R 250).
image_path String or char* - New single lined label

Version 1.2, February 2005

priint:comet InDesign® Plug-Ins, comet_pdf

static int set_docwatch(int state = 1)

Activate/Deactivate the document monitoring. Where document monitoring is activated, it will be attempted to load and execute the Panel statements of document monitoring.

Document monitoring will be automatically deactivated upon disconnecting the data link (Database logout, SOAP logout, change XML folder). The instruction is to be implemented in the Login script of the data link.

Name Type Default Description
Return int   0 or ErrorCode
state int 1 0 : Off
1 : On

Revision 117 (18 Jan. 2006)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

get_docwatch
comet.prefs.setDocWatch

static int get_docwatch()

Get the current status of the document monitoring.

Name Type Default Description
Return int   0 : deactivated
1 : activated

Revision 117 (18 Jan. 2006)

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

set_docwatch
comet.prefs.getDocWatch

static char* revision()

Get the current revision of Comet plugins.

Name Type Default Description
Return char*   Revision of current Comet plugins.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

Show current revision number.

int main ()
{
    showmessage (system::revision ());
    return 0;
}

The revision number is a string. Use it as integer:

int gRev = 0;
int main () { gRev = val (system::revision ()); showmessage ("%d", gRev);
return 0; }

Revision 166 (25. Aug. 2006)

priint:comet InDesign® Plug-Ins, comet_pdf

comet.getRevision

static char* comet_version()

Get the current version of Comet plugins.

Name Type Default Description
Return char*   Version of current Comet plugins.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

Show the current environment.

int main ()
{
    showmessage ("Comet %s R%s, InDesign® CS%d",
     	system::comet_version (),
     	system::revision (),
     	system::version ()-2); // Versionsnummer von ID ist CS-Version+2
return 0; }

You may use the function to take care on functions not implemented in earlier versions of Comet plugins.

int  gMinRevision = 1881;
int main () { if (val (system::revision ()) >= gMinRevision) { if (fval (system::comet_version ()) > 3.1) { implemented_in_R1881_Comet32 ("aaa"); } }
showmessage ("Where if not now?!"); return 0; }

Comet 2.1, R1946, 16. June 2010

priint:comet InDesign® Plug-Ins, comet_pdf

comet.getVersion

static int placeholderversion(ItemRef docRef = 0)

Get the current internal placeholders versions of a given document.

Name Type Default Description
Return int   Placeholder version.
docRef ItemRef 0 Document
-1 : placeholder version supported by the plug-inss
0 : current front document
otherwise : valid document references

Show the current placeholder version supported by the plug-ins.

int main ()
{
    showmessage ("Plugins : %d\nDokument : %d",
    system::placeholderversion (-1),
    system::placeholderversion ());
    return 0;
}

Revision 166 (25. Aug. 2006)

priint:comet InDesign® Plug-Ins, comet_pdf

static int version(int* hostApp = 0)

Find out the type and version number of the applicartion that runs the script.

Name Type Default Description
Return int   InDesign® (major) version

12 : InDesign® CC 2017
13 : InDesign® CC 2018
14 : InDesign® CC 2019
15 : InDesign® 2020
16 : InDesign® 2021
17 : InDesign® 2022
18 : InDesign® 2023
...

24 : Illustrator® 2020
25 : Illustrator® 2021
26 : Illustrator® 2022
27 : Illustrator® 2023
...

-1 : comet_pdf
hostApp int* 0 If the parameter != 0, it gets the following value for the type of the hosting app:

0 = InDesign®
1 = InDesign® Server
2 = comet_pdf
3 = Illustrator®
int main ()
{
    int 	app;
    int 	version	= system::version (&app);
    char	cc		[10];
if (app == 3) { showmessage ("Illustrator %d", 1996 + version); } else if (app == 2) { showmessage ("comet_pdf"); } else { if (version < 15) strcpy (cc, " CC"); else strcpy (cc, "");
if (app == 1) showmessage ("InDesign%s Server %d", cc, 2005 + version); else showmessage ("InDesign%s %d", cc, 2005 + version); }
return 0; }

Version 1.4.2, R 526, 14. Dec. 2007
Values 2 and 3 for hostApp since v4.2 R32023

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int language()

Language of the used InDesign®.

Name Type Default Description
Return int   Language Key

0 : English (US)
1 : English (UK)
2 : German
3: France
4 : Japanese
5 : Spainish
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 (Windows only)
int main ()
{
    int isServer;
showmessage ("IDVersion : %d\rServer : %d\rSprache : %d",   system::version (&isServer),   isServer,   system::language ());
return 0; }

Version 1.4.2, R 526, 14. Dec. 2007

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int sleep(long time_ms)

Sleep

Name Type Default Description
time_ms int - milliseconds

Version 1.4.2, R 603

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int suppress_layout_rules(int what = 0)

Suppress layout rules for certain situations. The instruction applies globally and until released by wakeup_layoutrules or until the current data connection is disconnected.

Please note that this function determines in which situations layout rules should be suppressed and applies to all layout rules. To supress individual layout rules or to execute them only exclusively use the functions suppress_layout_rule (without s at the end) or exclusive_layout_rule.

Name Type Default Description
Return int   Currently acivated rule types
what int 0 What types of rules you wish to suppress. (Its a bit field, you may add the following values)

Icon Value Situation
0 all
2 after load
1 after create
32 after built
4 page reorganization
8 after geometry changes

Version 3.1, R1550, 18. Sept. 2009

priint:comet InDesign® Plug-Ins, comet_pdf

wakeup_layout_rules
frame::apply_layout_rules
itemlist::apply_layout_rules
comet.prefs.getLayoutRulesState
comet.prefs.setLayoutRulesState

static int wakeup_layout_rules(int what = 0xFFFFFFFF)

Allow execution of layout rules for the given situation (again). Be extremely careful here : Only wake up rules you definitely turned off using suppress_layout_rules.

Please note that this function cancels locks of specified execution situations only. The function does not have any effects to individual locks or releases of layout rules using the suppress_layout_rule (without s at the end) or exclusive_layout_rule functions.

Name Type Default Description
Return int   Currently activated rule types
what int all What types of rules you wish to wake up. (Its a bit field, you may add the following values)
Icon Value Situation
0 all
2 after load
1 after create
32 after built
4 page reorganization
8 after geometry changes

Version 3.1, R1550, 18. Sept. 2009

priint:comet InDesign® Plug-Ins, comet_pdf

frame::apply_layout_rules
itemlist::apply_layout_rules
comet.prefs.getLayoutRulesState
comet.prefs.setLayoutRulesState

static int suppress_layout_rule(int ruleID = 0, int doSuppress = 0)

Suppressing/re-activating specific layout rules. Disabling a layout rule applies globally and until it is enabled again or until the current data connection is disconnected. The IDs of the default rules can be found here.

Conditions cannot be suppressed.

Layout rules rules can be additionally blocked for fixed situations with suppress_layout_rules (with s at the end). Re-releasing a layout rule with doSuppress = 0 has no influence on the general lock of the situation!

Please also note that re-activating a rule does not execute the rule immediately. The call only has the effect that the rule may be executed again the next time the layout rules are executed.

Name Type Default Description
Return int   0 or ErrorCode
ruleID int 0 ID of the layout rule

0 : Re-enable all suppressed layout rules, ignoring the doSuppress parameter.
doSuppress int 0 0 : Re-enable rule
1 : Suppress execution of the layout rule

v4.1.8, R28514, 4. May 2021

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

suppress_layout_rules
wakeup_layout_rules
frame::apply_layout_rules
itemlist::apply_layout_rules
comet.prefs.getLayoutRuleState
comet.prefs.setLayoutRuleState

static int exclusive_layout_rule(int ruleID = 0, int doSuppress = 1)

Restrict the layout rules to specified exclusive rules. If at least one layout rule is marked as exclusive, only rules marked as exclusive are executed and all other rules will be ignored. The exclusivity of a layout rule applies globally and until the exclusivity is withdrawn or the current data connection is disconnected. The IDs of the default rules can be found here.

Conditions can not be marked as to be exclusive.

Layout rules can be locked for certain situations by suppress_layout_rules (with s at the end). The locking of the situation also applies to exclusive rules and the withdrawal of exclusivity has no influence on the locking of the situation!

Please also note that granting exclusivity does not execute the rule immediately. The call only causes all non-exclusive rules to be suppressed the next time layout rules are executed.

Name Type Default Description
Return int   0 or ErrorCode
ruleID int 0 ID of the layout rule

0 : Withdraw all exclusive rights, the parameter doInclude is ignored in this case. By removing all exclusive rights, all rules suppressed with suppress_layout_rule will be ignored further!
doInclude int 0 0 : Withdraw exclusivity again. If no rule has exclusive rights after that, all rules suppressed with suppress_layout_rule are still ignored.

1 : Mark rule as exclusive.

v4.2 R31360, 12. Aug 2022

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

suppress_layout_rules
wakeup_layout_rules
suppress_layout_rule
frame::apply_layout_rules
itemlist::apply_layout_rules
comet.prefs.getLayoutRuleState
comet.prefs.setLayoutRuleState

static int commit_global(char* name = 0)

Write the current value of a global variable back to the current data pool.

Global variables can be created, modified and deleted via the Settings panel.

Global variables are not supported by PubServer connections.

Name Type Default Description
Return int   0 or ErrorCode
name String or char* - Write the value of this variable. Take care to take the variable name, not the variable itself (for example "gCounter" instead of gCounter).

empty or "" : Write values of all global variables

Change the value of gInt to 123.

int main ()
{
    gInt = 123;
    system::commit_global ("gInt");
return 0; }

Version 3.1, R1555, 22. Sept. 2009

priint:comet InDesign® Plug-Ins, comet_pdf

static int reload_globals()

Reload all global variables. Changes made on globale will be lost. To save local changes to global variables, use system::commit_global.

Global variables can be created, modified and deleted via the Settings panel.

Global variables are not supported by PubServer connections.

Name Type Default Description
Return int   0 or ErrorCode

Version 3.1, R1760, 23. Feb. 2010

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static int send_mail(
  char* to,
  char* subject,
  ...)

Send an email to a given address.

The function is a nice to have: We will help you by any problem, but the function in not subject of support.

On Mac OS X we use the standard servive Postfix to send emails. You need to configure this system at first. Followthe nexts steps to configure postfix. (You will need admin access for configuration!

  1. Open programm Terminal and navigate to /etc/postfix:

    cd /etc/postfix

  2. Open file /etc/postfix/main.cf and append the following lines. Replace your_smtp by your mail server, e.g. smpt.casagrande.de. Do not remove the brackets!

    As sender address yur login name and the value of myorigin is used: My login name is paul. So myorigin = your_side.de will create the sender address paul@your_side.de.

    If you know how to change the name in the sender address too, please let us know!

    relayhost = [your_smtp] myorigin = your_mail_domain smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/smtp_sasl_passwords smtp_sasl_security_options = noanonymous smtp_use_tls = yes

    Don't forget the brackets around the server.

  3. Create the file /etc/postfix/smtp_sasl_passwords and add the following line. Replace \span[src]{your_smtp by your mail server, your_mail_address by your email address on this server and your_password by the according password, e.g. paul@casagrande.de:verrat_ich_N1cht.

    [your_smtp] your_mail_address:your_password

    Set owner and permisssions of the new file and init the Postfix lookup table:

    sudo chown root smtp_sasl_passwords
    sudo chmod 411 smtp_sasl_passwords
    sudo postmap smtp_sasl_passwords
    
  4. Restart the Postfix mail service:

    sudo Postfix stop
    sudo Postfix start
    
  5. You're ready now. Try the confugration by sending you an email:

    date | sendmail -f your_mail_address your_mail_address

    You should get an email after a short while.doc

Using Windows, the confuguration is much more simpler - you have to do ... nothing. But : You have to give the function itself all the needed information about the mail account. Alternatively you can store the account information:

Name Type Default Description
Return int   0 or ErrorCode
to String or char* - Complete address of receiver
subject String or char* - subject of mail, may be 0 or "".
type, content int, String or char* -,- List of (Type, Content) pairs to compose the mail. Under Mac OS X, account information like (kSMTPServer, ...) are ignored

kBopy Text (plain or HTML)

kInline : Cpmplete path of file. Under Mac OS X, the file will be placed inside the text. Unter Windows, the file is appended as a regular attachment.

kAttachment Complete path of attachment file

kSMTPServer Windows only SMTP server
kLoginName Windows only user name on SMTP
kPassword Windows only passwort of user
kSenderName Windows only anme of sender (used only to show in mail application)
kReplyTo Windows only mail address of sender and to replay to

kMailAccount Windows only Use this mail account, see above
#include "internal/types.h"

Here's an example:

system::send_mail (
 			"paul@priint.com",
 			"Hier die Dokumente",
 			kMailAccount, "emile",
 			kBody, "Hello Paul!\nHere are the desired files",
 			kInline, "$DESKTOP/Bilder/buffer.jpg",
 			kInline, "$DESKTOP/Bilder/docu.pdf",
 			kBody, "\n\nFor me it was a pleasure!");

v3.3.1 R3121, 8. Oct. 2012
Windows support since v4.0.5 R15678, 13. Feb 2017

priint:comet InDesign® Plug-Ins, comet_pdf

static int font_info(
  char* platform_name,
  int style,
  char* postscript_name,
  float* asc,
  float* desc)

Collect information to a given font. You will need this function to configure the comet_pdf font settings well.

Name Type Default Description
Return int   0 or ErrorCode
platform_name String or char* - InDesign® name of a font. The name can include a blank delimited style information (But no NOT append the default style 'Regular'). If empty, the variable will contain the font name of postscript_name after successful return.
style int - font style

0 : normal
1 : italic
2 : bold
3 : bold italic
4 : small caps
4 : caps (Ja, dieser Fehler ist so in der InDesign®-API enthalten.)

In most cases you will define the style in the name and leave this parameter 0.
postscript_name String or char* - Postscript name of the font. If empty, the variable is filled by the ps name of platform_name on successful return. if not empty, platform_name is filled with the font name used by InDesign® vice versa.
asc float* 0 Ascender of font in 10 Pt.
desc float* 0 Descender of font in 10 Pt.

Get the font of the current text selection, query information about the font and show the result in a dialog. Users may copy the dialogs result into fontnames.xml of comet_pdf.

int main ()
{
    int				start;
    ItemRef			fr		= item::alloc ();
    char			fname	[512];
    char			font	[512];
    char			style	[512];
    char			idname	[512];
    char			psname	[512];
    float			asc		= 0.0;
    float			desc	= 0.0;
    char			s		[4096];
    char			s1		[4096];
    char			s2		[4096];
if (gRun > 1) return 0;
strcpy (font, ""); if (textmodel::selection (&start, 0, fr) == 0 && start >= 0) { textmodel::get_font (fr, start, font, style); } if (strlen (font) == 0) { beep (); return 0; }
strcpy (fname, font); if (strcmp (style, "Regular")) { strcat (fname, " "); strcat (fname, style); } asc = 0.0; system::font_info (fname, 0, psname, &asc, &desc);
sprintf (s, "<fontname id=\"%s %s\" ps=\"%s\"/>", font, style, psname); strcpy (s1, s); strcat (s1, "n"); sprintf (s, "<fontname id=\"%s %s\" ps=\"%s\" asc=\"%f\" desc=\"%f\"/>", font, style, psname, asc, desc); strcat (s1, s); sprintf (s2, "InDesign®-Name\t: %s\nPostscript-Name\t: %s\nAscend\t\t: %f\nDescend\t\t: %f", fname, psname, asc, desc); askstring2 (   s1, "XML", 1,   s2, "Font", 1,   0, "", "",   0, "", 0,   "fontnames.xml");
return 0; }

v3.4 R7740, 31. Mar 2015

priint:comet InDesign® Plug-Ins, comet_pdf

static int cmd(char* cmd_string, int createProcess = 0)

Execute a shell command.

Name Type Default Description
Return int   0 or ErrorCode
platform_name String or char* - Valid command for terminal shell.
createProcess int 0 The parameter is meaningful under Windows only.

To execute the instruction, a new console is started under Windows. This console is visible for a short moment. Set createProcess to 1 to suppress this window.

Attention: compound statements with redirects (>, <) and/or pipes (|) can not be executed here and generate the error 1290 (cannotCreateProcessErr).

Copy the ID1 of currently selected text placeholder to the clipboard.

int main ()
{
    int 			sel;
    int 			id;
    char 			cmd [5000];
textmodel::selection (&sel); if (sel >= 0) { id = placeholder::get_value (gFrame, "ID", sel); if (system::os () == 1) sprintf (cmd, "echo \"%d\\c \" | pbcopy", id); else sprintf (cmd, "echo | set /P=\"%d\" | clip", id); } system::cmd (cmd);
return 0; }

Parameter createProcess since v4.0.5 R14550, 18. Jan 2017
v4.0.5, 1. Dec 2015

priint:comet InDesign® Plug-Ins, comet_pdf, Illustrator

static char* key_value(
  char* key,
  ItemRef frameRef = 0,
  int startPos = 0,
  int len = -1)

Get the value of a tagged key. In direct statements of placeholders and in panelstatements a set of <Taggged_keys> are defined. (See here for a complete list of supported tags.). All this values are available in various functions of cScript. We offer an uniform method here.

Name Type Default Description
Return char*   Value for the key.

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

key String or char* - Name of key, see here

Keys must be given without the angle brackets.
frameRef ItemRef 0 Frame reference. Ignored in case of independent keys like "now" or "user"

0 : Current script frame
startPos int 0 Start position in text given as letter position (not in bytes). Only used for text based keys like "text".
len int kLen Length of text in letters (not in bytes). Only used for text based keys like "text".
#include "internal/text.h"

v4.0.5, 14. Dec 2016

priint:comet InDesign® Plug-Ins, comet_pdf

static int used_memory()

Currently used memory of application (InDesign® or comet_pdf).

Internal use only %nbsp;The function is for internal usage of WERK 2 only.

Name Type Default Description
Return int   Currently used memory of application (InDesign® or comet_pdf) in bytes
showmessage ("RAM : %2.f MB", ((float)system::used_memory ()/1024.0)/10.24.0);

v4.0.5, 10. Apr 2017

priint:comet InDesign® Plug-Ins, comet_pdf

static int fontdb_count()

Number of entries in the internal font database. The font DB is needed to correctly resove bold and italic while converting HTML into TaggedText. See here for more information.

Name Type Default Description
Return int   Number of entries in font DB

The script writes all entries of the font DB into the current log file.

int w_stretch (int s, char* fontname, int * done)
{
    if (!(*done))
    {
        if (fontname)	wlog ("", "#   Stretch %d '%s'\n", s, fontname);
        else			wlog ("", "#   Stretch %d\n", s);
    }
    *done = 1;
}
int main () { int fcount = system::fontdb_count (); int f, w, s; // font, weight, stretch int pr, pi; // priority (explicitly defined or 'autofill') char fontname[512], regular[255], italic[255]; int shift = system::shiftkey (); int stretch_wrote;
wlog ("", "# Font DB : %d fonts registered (%d mappings!).\n", fcount, fcount*81*2);
for (f = 0; f < fcount; f++) { // Get the font family name strcpy (fontname, system::fontdb_get_fontname (f)); wlog ("", "# %d. Font '%s'\n", f, fontname);
// for all stretches for (s = -4; s <= 4; s++) { stretch_wrote = 0;
// for all weights for (w = 0; w <= 8; w++) { strcpy (regular, system::fontdb_by_index (f, w, s, 0, &pr)); strcpy (italic, system::fontdb_by_index (f, w, s, 1, &pi));
if (!shift) { // Write explicitly defined entries only if (pr) { w_stretch (s, 0, &stretch_wrote); wlog ("", "# %d N '%s'\n", (w+1)*100, regular); } if (pi) { w_stretch (s, fontname, &stretch_wrote); wlog ("", "# %d I '%s'\n", (w+1)*100, italic); } } else { // Write auto-filled entries too w_stretch (s, fontname, &stretch_wrote); if (pr) wlog ("", "# %d N+ '%s'\n", (w+1)*100, regular); else wlog ("", "# %d N- '%s'\n", (w+1)*100, regular); if (pi) wlog ("", "# %d I+ '%s'\n", (w+1)*100, italic); else wlog ("", "# %d I- '%s'\n", (w+1)*100, italic); } } } } return 0; }

v4.1 R23100, 18. May 2017

priint:comet InDesign® Plug-Ins, comet_pdf

fontDB
fontdb_get_fontname
fontdb_by_index
fontdb_by_name
fontdb_mark_missing

char* fontdb_get_fontname(int nth)

Get the font family name of the n-th entry of the font DB.

Name Type Default Description
Return char*   Font family name of the n-th entry of the \URL[font DB]URL[Font-DB]{../InDesign/Plugins/comet_pdf.html#fontstyle}
"" : In case of an error

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-based index

v4.1 R23100, 18. May 2017

priint:comet InDesign® Plug-Ins, comet_pdf

fontDB
fontdb_count
fontdb_by_index
fontdb_by_name
fontdb_mark_missing

char* fontdb_by_index(
  int nth,
  int weight,
  int stretch,
  int italic,
  int* priority)

Get the font face of the font family for a given weight, stretch and style. The font family is adressed by its index inside the font DB.

Name Type Default Description
Return char*   Font face defined in the font DB
"" : In case of an error

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth int - 0-basierter Index in der Font-DB.
weight int - 0 ... 8

0 : font-weight:100;
1 : font-weight:200;
:
8 : font-weight:900;
stretch int - -4 ... 4

-4 : font-stretch:ultra-condensed;
-3 : font-stretch:extra-condensed;
-2 : font-stretch:condensed;
-1 : font-stretch:semi-condensed;
0 : font-stretch:normal;
1 : font-stretch:semi-expanded;
2 : font-stretch:expanded;
3 : font-stretch:extra-expanded;
4 : font-stretch:ultra-expanded;
italic int - 0 : normal
1 : italic
priority int* 0 Return value:

1 : explicitly defined
0 : auto filled

Variable may be empty.

v4.1 R23100, 18. May 2017

priint:comet InDesign® Plug-Ins, comet_pdf

fontDB
fontdb_count
fontdb_by_name
fontdb_mark_missing

char* fontdb_by_name(
  char* fontname,
  int weight,
  int stretch,
  int italic,
  int* priority)

Get the font face of the font family for a given weight, stretch and style. The font family is adressed by its index inside the font DB.

Name Type Default Description
Return char*   Font face defined in the font DB
"" : In case of an error

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

nth char* or String Font family name inside the font DB.  
weight int - 0 ... 8

0 : font-weight:100;
1 : font-weight:200;
:
8 : font-weight:900;
stretch int - -4 ... 4

-4 : font-stretch:ultra-condensed;
-3 : font-stretch:extra-condensed;
-2 : font-stretch:condensed;
-1 : font-stretch:semi-condensed;
0 : font-stretch:normal;
1 : font-stretch:semi-expanded;
2 : font-stretch:expanded;
3 : font-stretch:extra-expanded;
4 : font-stretch:ultra-expanded;
italic int - 0 : normal
1 : italic
priority int* 0 Return value:

1 : explicitly defined
0 : auto filled

Variable may be empty.

v4.1 R23100, 18. May 2017

priint:comet InDesign® Plug-Ins, comet_pdf

fontDB
fontdb_count
fontdb_by_name
fontdb_mark_missing

int fontdb_mark_missing(
  int type,
  int red,
  int green,
  int blue,
  float tint)

Mark text for which the font DB can not find a suitable font style. We offer three ways to mark text for which no matching typeface is found:

The setting applies globally to all documents. Activated markers are reset when disconnecting the data connection.

Attention: The markings must be removed manually!

Name Type Default Description
Return int   0 or ErrorCode
⇨ No markings
type int - 0 : No markings
⇨ Font tint
type int - 1 : Font tint
tint int - Value of tint : 0.0 (invisible) - 100.0
⇨ Font color and tint
type int - 2 : Font color and tint
red int - Red part of color (0-255)
green int - Green part of color (0-255)
blue int - Blue part of color (0-255)
tint int - Tint in the range 0.0 (invisible) - 100.0
⇨ Farbband
type int - 3 : Colored background


Under comet_pdf the slanted gray lines are omitted.

v4.1 R23100, 18. May 2017

priint:comet InDesign® Plug-Ins, comet_pdf

fontDB
fontdb_count
fontdb_by_name
fontdb_by_index

char* fontdb_check(int what)

Check the \URL [font configuration]{../InDesign/Plugins/comet_pdf.html#fontstyle}. The function checks whether all fonts currently installed on your computer are defined in your font database.

The function checks the existence of the entries, not their correctness.

To complete a comet_pdf installation you first have to define the font names (what=2). After that you can adjust the font-DB in a further step. Alternatively you can do it without this script function and call comet_pdf with the option --checkfonts N.

Name Type Default Description
Return char*   String with the missing defitnions
"" : In case of error

The return value is read only, do NOT CHANGE. The result will be overridden on following calls to the function. See here to learn more about functions returning r/o char* values.

what int 4 Type and format of the review. The results must be checked before further usages!

1 : comet_pdf only Missing entries for translating InDesign fontnames into PDF. The output is C++ formatted. If you think that these fonts must be included in the standard please send it together with a short message directly \URL [to us]{mailto:paul@priint.com?subject=FontDB Extension}.

2 : comet_pdf only Missing entries for translating InDesign fontnames into PDF. The output is XML formatted and can be inserted directly into your fontnames~.xml.

3 : Missing definitions in Font-DB. The output is C++ formatted. If you think that these fonts must be included in the standard please send it together with a short message directly \URL [to us]{mailto:paul@priint.com?subject=FontDB Extension}.

4 : Missing definitions in Font-DB. The output is XML formatted and can be inserted directly into your font_db.xml.
int main ()
{
    wlog ("", "%s", system::fontdb_check ());
return 0; }

v4.1.7 R26700, 5. May 2020

priint:comet InDesign® Plug-Ins, comet_pdf

int main ()
{
    char	s1 [256];
    char	s2 [256];
    char	s3 [256];
    showmessage ("%s : %s@%s",
     	system::realname (s1),
     	system::login (s2),
     	system::host (s3));

Author
Paul Seidel
Version
16.10.2024, 11:40 Uhr
Since
Plugin Version 1.0.10

Alphabetic index HTML hierarchy of classes or Java