Platforms to show: All Mac Windows Linux Cross-Platform

Back to ResourceForkMBS class.

ResourceForkMBS.AddResource(Data as Memoryblock, ResourceType as String, ID as Integer, Name as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a resource of the Type specified, using the Name and ID specified and fills it with the Data specified.

We added this method to avoid extra conversion from memoryblock to string when adding data.

See also:

ResourceForkMBS.AddResource(Data as String, ResourceType as String, ID as Integer, Name as String)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Adds a resource of the Type specified, using the Name and ID specified and fills it with the Data specified.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.Create(f)

r.AddResource "Hello World", "TEXT", 128, "just a test"

See also:

ResourceForkMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Closes the open resource fork.

The resource fork will be closed automatically when the instance is destroyed.

ResourceForkMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The private constructor.

ResourceForkMBS.GetIndResource(ResourceType as String, index as Integer) As String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the specified resource as a string.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.create(f)

r.AddResource "Hello World", "TEXT", 128, "just a test"

Var s as string = r.GetIndResource("TEXT", 0)
MsgBox s

Index is zero based.

ResourceForkMBS.GetNamedResource(ResourceType as String, Name as String) As String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the specified resource as a string.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.create(f)

r.AddResource "Hello World", "TEXT", 128, "just a test"

Var s as string = r.GetNamedResource("TEXT", "just a test")
MsgBox s

ResourceForkMBS.GetResource(ResourceType as String, ID as Integer) As String

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the specified resource as a string.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.create(f)

r.AddResource "Hello World", "TEXT", 128, "just a test"

Var s as string = r.GetResource("TEXT", 128)
MsgBox s

Some examples using this method:

ResourceForkMBS.GetResourceMemory(ResourceType as String, ID as Integer) As Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the specified resource as a Memoryblock.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.create(f)

r.AddResource "Hello World", "TEXT", 128, "just a test"

Var s as MemoryBlock = r.GetResourceMemory("TEXT", 128)
MsgBox s

ResourceForkMBS.UniqueID(ResourceType as String) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Finds an unique ID for a given resource type.
Example
Var f as FolderItem = SpecialFolder.Desktop.Child("test.rsrc")
Var r as ResourceForkMBS = ResourceForkMBS.create(f)

MsgBox str(R.UniqueID("TEXT"))

The items on this page are in the following plugins: MBS MacClassic Plugin.


The biggest plugin in space...