DocSetScriptΒΆ

DocSetScript copies a script into a UniPlot document. The script will be executed when the document is opened.

bool = DocSetScript(hDoc, ssScript)

Return Value

If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0).

Parameters

hDoc

Identifies the document.

ssScript

ssScript ist ein Text mit UniScript-Anweisungen.

Comment

With this function a text with UniScript functions can be copied into a document.

When the document is opened, e.g. with a double-click in the Windows Explorer, with the File=>Open command or by selecting a file from the recent file list, code saved in the document will be executed.

The following actions will be performed:

  • The DocCreate function will be invoked.
  • The DocGetScript function will be executed.
  • A warning message will be displayed that the document contains macros. You should only load the macros if you can trust them. Otherwise the macro can contain a macro virus that can do some damage such as delete data.
  • The script will be executed with evalp. If the script contains errors a message box will be displayed.

The Edit Object=>Properties contains a script example for the text object callback function.

Security: The function to execute the macros use the following function call:

nSecurity = GetProfileInt_Policy("Settings", "macro-security", 0);

The third parameter can contain the following values:

  • 0 - prompt: Default setting. A message box will be displayed with a query whether to allow the script to run.
  • 1 - never: Disable all macros. A log message will be added to the event window.
  • 2 - always: Runs the macros without user intervention.

History

Version Description
R2012.2 (5.40.2) New.

id-1433913