Platforms to show: All Mac Windows Linux Cross-Platform

Back to FolderItem class.

FolderItem.SetFolderFlagsMBS(flags as Integer) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Files MBS MacClassic Plugin ✅ Yes ❌ No ❌ No ✅ Yes All
Set the folder flags for the folderitem to the given value. Returns 0 if okay.
Example
Dim f As FolderItem = GetFolderItem("test") // some folder
If f.SetFolderFlagsMBS(BitwiseOr(f.GetFolderFlagsMBS, 4)) <> 0 Then
MsgBox "Can't set label to green."
End If

Sets the frFlags of a folder. Returns an error code (or zero if no error occured). Possible error conditions include "disk is write protected" and "folder not found".
When changing flags of a folder, use GetFolderFlags to get the original flags, then clear or set the flags by using BitwiseAnd and BitwiseOr and call SetFolderFlags to set the new flags.

with values 2, 4 and 8 in the flags, you control the label color in Finder. Example code above uses 4 which is green by default.

If you need to set bundle bit in newer projects, please use SetResourcePropertyForKey on CFURLMBS class with kCFURLIsPackageKey key.

Some examples using this method:

Blog Entries

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


The biggest plugin in space...