Lingo Dictionary > S > setPref |  |

setPref

Syntax

    setPref prefFileName, prefValue

Description

Command; writes the string specified by `prefValue` in the file specified by `prefFileName` on the computer's local disk. The file is a standard text file.

The`prefFileName` argument must be a valid file name. To make sure the file name is valid on all platforms, use no more than eight alphanumeric characters for the file name.

After the `setPref` command runs, if the movie is playing in a browser, a folder named Prefs is created in the Plug-In Support folder. The `setPref` command can write only to that folder.

If the movie is playing in a projector or Director, a folder is created in the same folder as the application. The folder receives the name Prefs.

Do not use this command to write to read-only media. Depending on the platform and version of the operating system, you may encounter errors or other problems.

This command does not perform any sophisticated manipulation of the string data or its formatting. You must perform any formatting or other manipulation in conjunction with `getPref()`; you can manipulate the data in memory and write it over the old file using `setPref`.

In a browser, data written by `setPref` is not private; any Shockwave movie can read this information and upload it to a server. Do not store confidential information using `setPref`.

To see an example of `setPref` used in a completed movie, see the Read and Write Text movie in the Learning\Lingo Examples folder inside the Director application folder.

Example

This handler saves the contents of the field cast member Text Entry in a file named DayWare settings:

    on mouseUp me
    	setPref "CurPrefs", member("Text Entry").text
    end

See also

`getPref()`