getpreferencevalue(
getpreferencevalue(
PREFERENCE
,
DOMAIN
)

The getpreferencevalue( function retrieves the value of a preference.

Parameters

This function has two parameters:

preference – is the name of the preference to be retrieved.

domain – is the name of the domain that contains the preference. This parameter is optional, if omitted then only Panorama and system preferences can be retrieved.

Description

Panorama uses OS X to manage the storage of preferences for each user. Using preferences, you can easily store user preferences persistently so that they are retained when Panorama is quit and relaunched. This system is also used by Panorama itself to store preferences, and also by OS X. You can use the getpreferences( function to access any stored preference value.

Each preference has a name and a value. (Apple calls the name a “key”). In this example the name is JKAreaCode and the value is 562. (To change the value, use the [setpreferencevalues][] statement.)

    getpreferencevalue("JKAreaCode") <result>562</result>

The getpreferencevalue( function can retrieve any value you have stored with the [setpreferencevalues][] statement, and it can retrieve text, numbers and boolean values stored by Panorama or the operating system. More complex data stored by Panorama or the operating system cannot be retrieved (a future version of Panorama may have additional capabilities for retrieving more complex data).

#### Specifying an Additional Domain

Normally only preferences stored by Panorama or the operating system can be retrieved. By adding a second parameter, additional domains can be included. This example retrieves the name of the person that most recently created a PDF file on this computer.

    getpreferencevalue("PDFAuthor","org.cups.PrintingPrefs") <result>John Warnock</result>

Use the info(“preferencedomains”) function to get a list of all of the available domains on your computer.

Error Messages

preference “name” does not exist – There is no preference with the name you requested.

cannot decode value of preference – The requested preference contains a complex data type that is not compatible with Panorama.

See Also

- info("preferencedomains")

History

Version | Status | Notes
1.0 | New | New in this version.