../pvss.htm menu.gif basics.gif

getPath()

This function determines the absolute paths for panels, scripts etc.

Synopsis

string getPath(string keyword[, string filename[, int langId = activeLang[, int level = 1]]]);

Parameters

    Parameter

    Description

    keyword

    Directory from the project structure, see below

    filename

    The file name whose absolute path is to be determined (an entry does not have to be present)

    langId

    Language (with a language-dependent subdirectory (help, msg), the default is the active language

    level

    Numbering of all the directories of the search path from 1-SEARCH_PATH_LEN, where 1 is the <proj_dir> and SEARCH_PATH_LEN the <wincc_oa_dir> (the search is only carried out in the directory with the specified level). SEARCH_PATH_LEN is a defined constant that determines the maximum possible number of levels.

List of valid keywords:

    Keyword

    directory

    BIN_REL_PATH

    bin/

    SOURCE_REL_PATH

    source/

    HELP_REL_PATH

    help/

    MSG_REL_PATH

    msg/

    CONFIG_REL_PATH

    config/

    PICTURES_REL_PATH

    pictures/

    COLORDB_REL_PATH

    colorDB/

    PANELS_REL_PATH

    panels/

    IMAGES_REL_PATH

    images/

    SCRIPTS_REL_PATH

    scripts/

    LIBS_REL_PATH

    lib/

    DATA_REL_PATH

    data/

    DB_REL_PATH

    db/wincc_oa

    LTA_REL_PATH

    lta/

    LOG_REL_PATH

    log/

    DPLIST_REL_PATH

    dplist/

    NLS_REL_PATH

    nls/

    PIXMAPS_REL_PATH

    pictures/

    ICONS_REL_PATH

    pictures/

    GIF_REL_PATH

    pictures/

Return value

The return value is the absolute path of the supplied parameters (for example, of a particular file) or an empty string.

Errors

 

Description

This function determines the absolute paths for panels, scripts and other WinCC OA elements based on the current path list and language.

The following calls are possible:

    • getPath(<keyword>)

    returns <proj_path>/<directory for keyword>

    • getPath(<keyword>, <filename>)

    Searches for the specified file <filename> in all Directories <keyword> of the search path and returns the file with the complete path if the file is located in one of the directories of the search path or "" if the file was not found.

    • getPath(<keyword>, <filename>, <langId>)

    If the file is located in a language-dependent subdirectory, by default the active language will be used otherwise (if specified) the required language (Parameter: langId).

    • getPath(<keyword>, <filename>, <langId>, <level>)

    If a <level> (1..n) is specified, a search is only performed in the directory with the given level. The level is a numbering of all directories of the search path from 1-n where 1 is the <proj_path> and n the <wincc_oa_path>. To have easier access to the <wincc_oa_path>, getPath() should interpret level 0 as <wincc_oa_path>.

    • getPath(<keyword>, "", <langId>, <level>)

    Does not search for a file but returns the path with the required level

    <searchpath(level)>/<directory for keyword>/.

note.gifNote

The function getPath(HELP_REL_PATH, fileName) returns help/lang/fileName if the file exists in the lang directory. If the file exists only in the help/ directory, the function returns an empty string.

IconExample

For 1 parameter:

main()

{

string path;

path = getPath(MSG_REL_PATH); // path = <proj_path>/msg/

}

For 2 parameters:

main()

{

string path;

path = getPath(NLS_REL_PATH, "lang.dir");

// path = <proj_path>/nls/lang.dir

}

For 3 parameters:

main()

{

string path;

path = getPath(HELP_REL_PATH, "lang.dir", 1);

// path = <proj_path>/help/de_AT.iso88591

}

For 4 parameters:

main()

{

string path;

path = getPath(PANELS_REL_PATH, "", 1, 2);

// path = <proj_dir_2>/panels/

}

Relates to

File functions

Administration of managers

Availability

UI, CTRL, DP

Top Of Page

 

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved