Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
6.0.1 - English

Change language to:
Français - 日本語 - Português - Русский

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Scilab Help >> Preferences > setPreferencesValue

setPreferencesValue

Set preferences value

Syntax

setPreferencesValue(xpath, key_value [, doc])

Arguments

xpath

a string, represents the XPath request to get the node in the preferences file.

key_value

a 2xN matrix of strings, the key-values to set.

doc

a mlist typed XMLDoc, the XML document associated to the preference file.

Description

Set the values of the attributes in preferences file (SCIHOME+'/XConfiguration.xml').

Modifying incorrectly some preferences can alter Scilab's behaviour.

When doc is specified, the values are searched in this document. It is useful when several requests need to be done to avoid to parse again and again the same configuration file.

All valid XPath requests are possible. For example to write the XPath request to set proxy settings:

  • Open the file SCIHOME+'/XConfiguration.xml' and gets the nodes names to access to the expected node:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <interface height="600" path="1/" version="0.17" width="800">
        <general title="_(General)">
        ...
        </general>
        <web title="_(Web)">
            <body>
                <web command-browser="" command-mailer="" default-browser="true" default-mailer="true"/>
                <proxy enabled="false" host="" password="" port="" user=""/>
                <previous-proxy enabled="false" host="" password="" port="" user=""/>
            </body>
        </web>
        ...
    </interface>

    The path will be "/interface/web/body/proxy" (or to simplify "//web/body/proxy").

Examples

// Get the current values
prev = getPreferencesValue("//web/body/proxy", ["enabled", "host", "port"]);
setPreferencesValue("//web/body/proxy", ["enabled", "host", "port"; "true", "my.proxy.org", "1234"]);

// Ok that's work
getPreferencesValue("//web/body/proxy", ["enabled", "host", "port"])

// We restore the previous values
setPreferencesValue("//web/body/proxy", ["enabled", "host", "port" ; prev]);
getPreferencesValue("//web/body/proxy", ["enabled", "host", "port"])

See also

  • getPreferencesValue — Parses and gets values of chosen tags attributes in a XML file of preferences
Report an issue
<< SciNotes preferences Preferences Scilab code coverage >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Mon Feb 12 19:27:00 CET 2018