Error getting tags :
error 404Error getting tags :
error 404 setResource | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
setResource
Basics
Expander triangle
Type
Function
Syntax
setResource(destinationFile,resourceType,[resID],[resName],flagsList,data)
Introduced
1.1
Environment
Desktop,Web
Platform Support
MacOS,Mac OS X
Security
Disk
Summary
Places data in a specified resource in a Mac OS file.
Examples

setResource("Include","BNDL",129,"document",RL,the bundleData of me)
setResource(it,"ICON",128,,,getResource(it,"ICON",130))

Additional Comments
Expander triangle

Use the setResource function to create a resource or change its data.

Parameters:

The destinationFile is the location and name of the file that contains the resource you want to set. If you specify a name but not a location, Revolution assumes the file is in the defaultFolder.

The resourceType is the 4-character type of the resources you want to change.

The resID is an integer or an expression that evaluates to an integer.

The resName is a string or an expression that evaluates to a string.

The flagsList is a list that can contain one or more flag characters. The possible resource flags are as follows:

S System heap

U Purgeable

L Locked

P Protected

R Preload

C Compressed resource

The flags may be listed in any order. If a character is included, its corresponding resource flag is set to true. If the character is not included in the flagsList, its corresponding resource flag is set to false. If the flagsList is empty, all the flags are set to false.

The data is text or binary data, formatted appropriately for the resource type.

Value:

The setResource function returns empty.

Comments:

If the destinationFile does not exist, the setResource function creates the file. If the destinationFile exists but has no resource fork, the setResource function creates the resource fork and copies the resource to it.

If the destinationFile is open, the result is set to "Can't open resource fork".

If the specified resource already exists, the setResource function replaces the data in the resource with the data. Otherwise, the setResource function creates the resource.

You must specify either a resID or resName or both. If you specify one but not the other, the setResource function looks for an existing resource with the specified name or ID, and replaces its contents without changing the existing ID or name.

The setResource function is most useful when used with the getResource function. Use the getResource function to obtain resource data, process it as desired, then use the setResource function to change the resource.

Caution! Resource data must be in the specific format appropriate to the resource type. If you set a resource to data that is incompatible with its resource type, you may damage the resource or the entire resource fork of the file. For information on the format of standard resource types, see Apple Computer's technical documentation, Inside Macintosh, located at <http://developer.apple.com/techpubs/macos8/mac8.html>.

User Comments
Expander triangle