MBS Plugin Documentation

Search:

Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchie

New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0

The list of the   themes,   classes,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

Folderitem.LogicalFileResLengthMBS as double
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Works, Feedback.

Function: Returns the length of the logical disk space used for this file's resourcefork.
Example:
filesize.text=format(file.LogicalFileResLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the older double version for Realbasic older than release 2006r4.

Some examples which use this method:

folderitem.LogicalFileResLengthMBS as int64
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Plugin version: 7.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the logical disk space used for this file's resourcefork.
Example:
filesize.text=format(file.LogicalFileResLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the new 64bit integer version for Realbasic 2006r4 and newer.

Some examples which use this method:

Folderitem.LogicalFileTotalLengthMBS as double
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the logical disk space used for this file's datafork.
Example:
filesize.text=format(file.LogicalFileTotalLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the older double version for Realbasic older than release 2006r4.

Some examples which use this method:

folderitem.LogicalFileTotalLengthMBS as int64
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Plugin version: 7.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the logical disk space used for this file's datafork.
Example:
filesize.text=format(file.LogicalFileTotalLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the new 64bit integer version for Realbasic 2006r4 and newer.

Some examples which use this method:

Folderitem.LongPathMBS as string
method, Files, MBS Win Plugin (Win), class Folderitem, Console safe, Mac OS X: Does nothing, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the long path for the file.
Example:
msgbox f.longpathMBS

Notes:
Should be the same as f.absolutepath
Works with Windows NT 4 or newer.

Some examples which use this method:

NewFolderItemFSRefMBS(fsref as memoryblock) as FolderItem
global method, Files, MBS Util Plugin (Main), Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a FolderItem from a specified FSRef.
Example:
dim f,g as folderItem
dim m as memoryBlock

f=getfolderItem("")

m=f.FSRef

g=NewFolderItemFSRefMBS(m)
msgBox g.absolutePath // same path as f

Notes: Only useful for toolbox calls and on Mac OS 9 and later.
NewFolderItemFSRefNameMBS(fsref as memoryblock,name as string) as FolderItem
global method, Files, MBS Util Plugin (Main), Plugin version: 3.2, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a FolderItem from a specified FSRef.
Notes: Only useful for toolbox calls and on Mac OS 9 and later.
NewFolderItemFSSpecMBS(fsspec as memoryblock) as FolderItem
global method, Files, MBS Util Plugin (Main), Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Creates a FolderItem from a specified FSSpec.
Example:
dim m as MemoryBlock
dim parid,vrefnum as integer

m=GetFSSpecFromPPCApp

f=NewFolderItemFSSpecMBS(m)

// now for being PPC and getting fsspec from Intel

m=GetFSSpecFromIntelApp

// swap here the two fields
m.LittleEndian=true
vrefnum=m.Short(0)
parid=m.Long(2)

m.LittleEndian=false
m.Short(0)=vrefnum
m.Long(2)=parid

f=NewFolderItemFSSpecMBS(m)

Notes:
Only useful for toolbox calls.
With plugin version 3.2, this works also on Windows if QuickTime is installed!
NewFolderItemMBS(vRefNum as Integer, parID as Integer, name as String) as FolderItem
global method, Files, MBS Mac Plugin (MacTT), Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a FolderItem from a specified volume, the item's directory ID and its name.
Example:
dim f as folderItem

f=newfolderItem(-1)
msgBox f.absolutePath#

Notes: The vRefNum with value -1 is the boot volume on Mac OS.

Some examples using this method:

NewVolumeFolderItemMBS(vRefNum as Integer) as FolderItem
global method, Files, MBS Mac Plugin (MacTT), Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a FolderItem from a specified volume based on the volume reference number.
Example:
dim f as folderItem

f=NewVolumeFolderItemMBS(-1)
msgBox f.absolutePath

Notes:
The vRefNum with value -1 is the boot volume on Mac OS.

Pass in the vRefNum of any mounted volume and it returns the Volume as a FolderItem.
Returns nil if the vRefNum was invalid.

Some examples using this method:

Folderitem.OpenAsLargeBinaryStreamMBS(write as Boolean) as LargeBinaryStreamMBS
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Opens a file as a LargeBinaryStreamMBS.
Example:
l=f.OpenAsLargeBinaryStream(true)

Notes: Returns nil on any error.

Some examples which use this method:

folderitem.OpenAsResStreamMBS(write as Boolean) as ResStreamMBS
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Opens a file's resourcefork as a ResStreamMBS.

Some examples which use this method:

Folderitem.OpenWithAppMBS(TheApplication as FolderItem, inFront as Boolean) as Boolean
method, Files, MBS Mac Plugin (MacTT), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Opens a file using the given application.
Example:
b=document.OpenWithAppMBS(Simpletext,true)

Notes:
Similar to Launch (see Folderitem.Launch), with the additional option to specify the application that should be used to open the FolderItem object. Passing nil in the app parameter is functionally identical to calling Launch.

Works with Graphicconverter, but not with Preview!?
Added Windows support in version 3.4.

Some examples which use this method:

PathToFolderItemMBS(path as string) as folderitem
global method, Files, MBS MacOSX Plugin (MacOSX), Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns a folderitem for the given unix path.
Notes:
Works only on Mac OS X.
This function is not very good, as Apple doesn't document which path is exspected, which encoding the path should use (maybe UTF8) and when it fails.
(e.g. it currently doesn't work for pathes with "~" inside)
Folderitem.PermissionsMBS as PermissionsMBS
method, Files, MBS MacOSX Plugin (MacOSX), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns an object for the Permissions of a file.
Example:
dim f as FolderItem
dim p as PermissionsMBS

f=GetOpenFolderItem("special/any")

if f<>nil then
p=f.PermissionsMBS

if p<>Nil then // requires Mac OS X
p.Access=&H6

// &h000006 = -rw-------
// &h000600 = ----rw----
// &h060000 = -------rw-

if 0=p.SetPermissions then
MsgBox "Permissions set"
else
MsgBox "Permissions could not be set"
end if
else
MsgBox "We require Mac OS X"
end if
else
' nothing selected
end if

Some examples which use this method:

Folderitem.PhysicalFileDataLengthMBS as double
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file's data fork.
Example:
filesize.text=format(file.PhysicalFileDataLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the older double version for Realbasic older than release 2006r4.

Some examples which use this method:

folderitem.PhysicalFileDataLengthMBS as int64
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Plugin version: 7.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file's data fork.
Example:
filesize.text=format(file.PhysicalFileDataLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the new 64bit integer version for Realbasic 2006r4 and newer.

Some examples which use this method:

Folderitem.PhysicalFileResLengthMBS as double
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file's resourcefork.
Example:
filesize.text=format(file.PhysicalFileResLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the older double version for Realbasic older than release 2006r4.

Some examples which use this method:

folderitem.PhysicalFileResLengthMBS as int64
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Plugin version: 7.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file's resourcefork.
Example:
filesize.text=format(file.PhysicalFileResLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the new 64bit integer version for Realbasic 2006r4 and newer.

Some examples which use this method:

Folderitem.PhysicalFileTotalLengthMBS as double
method, Files, MBS Util Plugin (LargeStream), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file.
Example:
filesize.text=format(file.PhysicalFileTotalLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the older double version for Realbasic older than release 2006r4.

Some examples which use this method:

folderitem.PhysicalFileTotalLengthMBS as int64
method, Files, MBS Util Plugin (LargeStream), class folderitem, Console safe, Plugin version: 7.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the length of the physical disk space used for this file.
Example:
filesize.text=format(file.PhysicalFileTotalLengthMBS,"0")

Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

This is the new 64bit integer version for Realbasic 2006r4 and newer.

Some examples which use this method:

Folderitem.QuickLookMBS(MaxWidth as integer, MaxHeight as integer, IconMode as Boolean=false, ScaleFactor as double=1.0) as picture
method, Files, MBS Leopard Plugin (QuickLook), class Folderitem, Console safe, Plugin version: 7.7, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a thumbnail for the designated file.
Example:
dim f as FolderItem

f=DesktopFolder.Child("test.jpg")

// shows the icon in 128x128 scaled by factor 4:
Backdrop=f.QuickLookMBS(128,128,true,4)

// shows the icon in default size:
Backdrop=f.QuickLookMBS(128,128,true,0)

// shows preview of image in 128x128 pixels.
Backdrop=f.QuickLookMBS(128,128,false,0)

// shows preview of image in 512x512 pixels.
Backdrop=f.QuickLookMBS(128,128,false,4)

// shows preview of image in 512x512 pixels.
Backdrop=f.QuickLookMBS(512,512,false,0)

// use Icon function in case no preview is available:
Backdrop=f.IconMBS(512)


Notes:
Returns nil if Quick Look does not support this file type. In that case you may use folderitem.Icon() with the given size.

MaxWidth and MacHeight specify the maximum desired size.
If ScaleFactor is bigger than zero, it is used. Else the default value is used.
If IconMode is true, QL will produce an icon (ie a thumbnail and all the icon decor, like shadows, curled corner, etc.).

Some examples which use this method:

Folderitem.SetFileFlagsMBS(flags as Integer) as Integer
method, Files, MBS Mac Plugin (MacTT), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Set the file flags for the folderitem to the given value. Returns 0 if okay.
Example:
// For example, clearing a file's hasCustomIcon flag works like this:
fdFlags = f.GetFileFlagsMBS
if fdFlags >= 0 then
err = f.SetFileFlagsMBS(BitSet(fdFlags, 10, false))
if err <> 0 then
... oops, an error occured
(for instance, the disk could be write protected)
end
end

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

Some examples which use this method:

Folderitem.SetFolderFlagsMBS(flags as Integer) as Integer
method, Files, MBS Mac Plugin (MacTT), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Set the folder flags for the folderitem to the given value. Returns 0 if okay.
Notes:
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.

Some examples which use this method:

Folderitem.ShortPathMBS as string
method, Files, MBS Win Plugin (Win), class Folderitem, Console safe, Mac OS X: Does nothing, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the short path for the file.
Example:
msgbox f.ShortPathMBS

Notes:
In contrast to long path this is the short 8.3 path for Windows.
You need this for the WindowsMCI object.
Works with Windows NT 4 or newer.

Some examples which use this method:

Folderitem.UnixpathMBS as string
method, Files, MBS MacOSX Plugin (MacOSX), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the native path for the file.
Example:
dim sh as Shell
dim fi as FolderItem
dim s as String
dim t as TextConverter

sh = new Shell
fi = getfolderitem("test √") // or try some other file name

if fi = nil or fi.exists = false then
beep
return
end if

s="ls -al """ + fi.Unixpathmbs + """"

sh.Execute s
MsgBox sh.Result

Notes:
test on the Desktop could be this:
On Mac OS X: /Users/cs/Desktop/test
On Mac OS 9: Mac OS 9:Desktop folder:test
On Windows: c:\windows\desktop\test

This function will return an empty string if the path can not be encoded in a Realbasic String. For my tests ICQ's path which is includes the folder name "ICQ 3.0 ƒ" can not be converted to MacRoman for some reason.

With version 2.7 it works for existing and non existing files.

Some examples which use this method:

Folderitem.UnMountVolumeMBS as Boolean
method, Files, MBS Mac Plugin (Mac), class Folderitem, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Unmounts a volume.
Example:
if disk.UnMountVolumeMBS then
msgBox "Volume unmounted."
else
msgBox "There was an error!"
end if

Notes:
On Windows is no unmounting.
This works on Mac OS X for my internal disks, the Firewire disk, the iPod and my DVD drive.
Don't try it with the start volume! The Finder will complain!

Some examples which use this method:

Folderitem.VolGetFolderItemIDMBS(createFileIDs as Boolean) as Integer
method, Files, MBS Mac Plugin (MacTT), class Folderitem, Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns the unique FileID or DirID of a FolderItem.
Notes:
Returns the unique FileID or DirID of a FolderItem. This ID is unique over all items on the same volume. The value 2 always identifies the root directory, all negative values and positive ones above 15 are used for user-created files and folders, while the values 3-15 are used internally by the File System (for the Desktop Database, for example).
If the item does not exists, 0 (zero) is returned instead.

IDs for Folders can always be resolved back to a FolderItem using VolResolveID, while resolving FileIDs only works when they've previously been created explicitly. To create a resolvable FileID, pass true to the createFileIDs parameter. But be aware that if the FileID can not be created (because the disk is locked or because the File System Format does not support it), the call will fail and a zero will be returned!

So, if you are just interested in reading the FileID, pass false to the second parameter. This will not fail even there hasn't been created a resolvable ID for that file yet.

Some examples which use this method:

VolResolveIDMBS(volume as FolderItem, id as Integer) as FolderItem
global method, Files, MBS Mac Plugin (MacTT), Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function:
return a FolderItem for a passed FileID or DirID. If the item can not be resolved, nil is returned instead.
The first parameter specified the volume where you want to resolve the ID on.
Example:
dim f,g as folderItem
f=desktopfolder
g=VolResolveIDMBS(f,f.MacDirID)
msgBox f.absolutePath

Notes: This function returns a FolderItem for a passed FileID or DirID. If the item can not be resolved, nil is returned instead.

Some examples using this method:

VolResolveIDMBS(vRefNum as Integer, id as Integer) as FolderItem
global method, Files, MBS Mac Plugin (MacTT), Console safe, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function:
return a FolderItem for a passed FileID or DirID. If the item can not be resolved, nil is returned instead.
The first parameter specified the volume where you want to resolve the ID on.
Example:
dim f,g as folderItem
f=desktopfolder
g=VolResolveIDMBS(f.macVRefNum,f.MacDirID)
msgBox f.absolutePath

Notes:
This function returns a FolderItem for a passed FileID or DirID. If the item can not be resolved, nil is returned instead.
The first parameter specified the volume where you want to resolve the ID on.There is a bug in RB which may say "type mistmatch error" in RB. Than use the other variant of that function.

Some examples using this method:

Folderitem.VolumeFreeSizeKBMBS as Integer
method, Files, MBS Util Plugin (Main), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the size on the free space on volume which the folderitem objects points to.
Example:
msgBox "The volume with your system folder has "+str(systemfolder.volumeFreeSizeKBMBS)+" KBytes free."

Notes: This can't work with anything bigger than 2048 Gigabytes.

Some examples which use this method:

Folderitem.VolumeFreeSizeMBS as Double
method, Files, MBS Util Plugin (Main), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the size of the free space of the volume which the folderitem objects points to.
Example:
1. a short:
msgBox "The volume with your system folder has "+str(systemfolder.volumeSizeMBS)+" Bytes free."
2. a nicer:
dim d as double
dim s as string

d=systemfolder.VolumeFreeSizeMBS

if d>10000.0 then
if d>10000000.0 then
if d>10000000000.0 then
s=format(d/1024.0/1024.0/1024.0,"0")+" GigaBytes"
else
s=format(d/1024.0/1024.0,"0")+" MegaBytes"
end if
else
s=format(d/1024.0/1024.0,"0")+" KiloBytes"
end if
else
s=format(d,"0")+" Bytes"
end if

msgBox "On your drive with the system folder you have "+s+" free."

Notes: This should be used to handle any volume size.

Some examples which use this method:

Folderitem.VolumeInformationMBS as VolumeInformationMBS
method, Files, MBS Mac Plugin (Mac), class Folderitem, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns a VolumeInformationMBS object with detailed information about the volume where the folderitem's file is located on.
Notes: May return nil on errors.

Some examples which use this method:

Folderitem.VolumeSizeKBMBS as Integer
method, Files, MBS Util Plugin (Main), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the Size on the volume which the folderitem objects points to.
Example:
msgBox "The volume with your system folder is "+str(systemfolder.volumeSizeKBMBS)+" KB big."

Notes: This can't work with anything bigger than 2048 Gigabytes.

Some examples which use this method:

Folderitem.VolumeSizeMBS as Double
method, Files, MBS Util Plugin (Main), class Folderitem, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Returns the size on the volume which the folderitem objects points to.
Example:
1. a short:
msgBox "The volume with your system folder is "+str(systemfolder.volumeSizeMBS)+" big."
2. a nicer:
dim d as double
dim s as string

d=systemfolder.volumesizeMBS

if d>10000.0 then
if d>10000000.0 then
if d>10000000000.0 then
s=format(d/1024.0/1024.0/1024.0,"0")+" GigaBytes"
else
s=format(d/1024.0/1024.0,"0")+" MegaBytes"
end if
else
s=format(d/1024.0/1024.0,"0")+" KiloBytes"
end if
else
s=format(d,"0")+" Bytes"
end if

msgBox "Your drive with the system folder is "+s+" big."

Notes: This should be used to handle any volume size.

Some examples which use this method:

The items on this page are in the following plugins: MBS Leopard Plugin, MBS Mac Plugin, MBS MacOSX Plugin, MBS Util Plugin, MBS Win Plugin.