.. highlightlang:: us .. index:: DocSetScript .. _docsetscript: DocSetScript ============ .. us.tag DocSetScript ENGLISH DocSet New5402 :ref:`DocSetScript` copies a script into a UniPlot document. The script will be executed when the document is opened. .. function:: bool = DocSetScript(hDoc, ssScript) .. us.return **Return Value** If the function succeeds, the return value is TRUE (1); otherwise it is FALSE (0). .. us.params **Parameters** .. uparam:: hDoc Identifies the document. .. uparam:: ssScript *ssScript* ist ein Text mit UniScript-Anweisungen. .. us.comment **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 :ref:`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 :ref:`DocCreate` function will be invoked. * The :ref:`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 :ref:`evalp`. If the script contains errors a message box will be displayed. The :ref:`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. .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2012.2 (5.40.2) - New. .. seealso:: :ref:`overview-documents`, :ref:`DocCreate`, :ref:`DocGetScript` :sub:`id-1433913`