Platforms to show: All Mac Windows Linux Cross-Platform

Back to ProcessMBS class.

ProcessMBS.CPUTime as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the number of the ticks this Process did get to calculate.

Unit is 1/60 of a second.
On Mac OS X this value is not available and normally 0.
(Read only property)

Some examples using this property:

ProcessMBS.CurrentProcess as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns true if the application is in the current Process.

This should always be true because you are running Xojo as the current ProcessMBS while you ask for this.
(Read only property)

Some examples using this property:

ProcessMBS.flags as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin 4.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The flags for this process on Mac OS.
Example
Sub Open()
// List all visible processes

dim s as string
dim p as ProcessMBS
dim d As CFDictionaryMBS
dim LSBackgroundOnly, LSUIElement As CFStringMBS
dim b As CFBooleanMBS
dim obj As CFObjectMBS
dim visible as Boolean

const modeOnlyBackground=&h00000400

LSUIElement=NewCFStringMBS("LSUIElement")
LSBackgroundOnly = NewCFStringMBS("LSBackgroundOnly")

p = new ProcessMBS
p.getfirstProcess

do
visible=True

// Mac OS X
d = CFDictionaryMBS(p.ProcessInformationCFDictionary)

if d <> nil Then
obj = d.Value(LSBackgroundOnly)
if obj isa CFBooleanMBS then
b=CFBooleanMBS(obj)

if b.value Then
visible=false
end
end if

obj= d.Value(LSUIElement)
if obj isa CFBooleanMBS then
b=CFBooleanMBS(obj)

if b.value Then
visible=false
end
end if
end if

// Mac OS 9

if BitwiseAnd(p.Flags,modeOnlyBackground)<>0 then
visible=False
end if

if visible then
ListBox1.AddRow p.Name
end if

loop until not p.GetNextProcess
End Sub

Returns 0 on any error.

Process mode flags. These flags indicate whether the process is an application or desk accessory. For applications, this field also returns information specified in the application's 'SIZE' resource. This information is returned as flags. You can refer to these flags by using these constants:

modeDeskAccessory &h00020000
modeMultiLaunch &h00010000
modeNeedSuspendResume &h00004000
modeCanBackground &h00001000
modeDoesActivateOnFGSwitch &h00000800
modeOnlyBackground &h00000400
modeGetFrontClicks &h00000200
modeGetAppDiedMsg &h00000100
mode32BitCompatible &h00000080
modeHighLevelEventAware &h00000040
modeLocalAndRemoteHLEvents &h00000020
modeStationeryAware &h00000010
modeUseTextEditServices &h00000008
(Read only property)

ProcessMBS.FrontProcess as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns true if the application is in the front of all others.
Example
dim p as new ProcessMBS
p.GetCurrentProcess
p.FrontProcess=true 'bring app to front

This property is for read and write. Writing to it brings the Process to front.
(Read and Write property)

Some examples using this property:

ProcessMBS.lasterror as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin 3.1 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The last error code.

As this property is introduced with MBS Plugin 3.1, only a few functions set it.
0 means no error, -1 means not available and anything else is a Mac OS error code.
(Read and Write property)

ProcessMBS.LaunchProcess as ProcessMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the application which launched the current one.

For some applications like the "loginwindow" it is nil, because there was no app to launch it other than the system itself.
(Read only property)

Some examples using this property:

ProcessMBS.MacCreator as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the Mac Creator code for the application.

(Read only property)

ProcessMBS.MacType as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the Mac Type code for the application.

Possible values:
"APPL"normal application
"appe"background application (Classic)
"APPC"Control panel application (Classic)
"APPD"Desktop Accessory (Classic)
"FNDR"Finder
others may be possible.
(Read only property)

ProcessMBS.MemoryFree as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the size of the free space in the Process' memory partition.

On Mac OS X normally 0.
(Read only property)

Some examples using this property:

ProcessMBS.MemorySize as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns size of the Process' memory partition.

On Mac OS X normally 0.
(Read only property)

ProcessMBS.Name as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Returns the name of this application.

Added Windows support in MBS Plugin 2.7 for this property.
(Read only property)

ProcessMBS.Path as folderitem

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the path of the Process' executable file.

Maybe nil if not available.
Use this folderitem to get an icon for the Process.
(and this icon may be nil!)
(Read only property)

ProcessMBS.ProcessID as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ✅ Yes ❌ No ❌ No Desktop, Console & Web
Returns the PID of the process for use in unix command line tools.
Example
Function LoginWindowPID() as Integer
// returns Process ID of Loginwindow on Mac OS X.
// or 0 on error

dim p as ProcessMBS

p=new ProcessMBS
p.GetFirstProcess

do
if p.Name="loginwindow" then
Return p.ProcessID
end if
loop until not p.GetNextProcess
End Function

Works only on Mac OS X.
See the "CPU Focus" application for an example.

Note that this call does not make sense for Classic applications, since they all share a single UNIX process ID.
(Read only property)

ProcessMBS.Visible as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Process MBS Util Plugin ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns true if the application is visible.
Example
// hide iTunes

dim p as new ProcessMBS

p.GetFirstProcess
do
if p.BundleID="com.apple.iTunes" then
p.Visible=false
exit
end if
loop until not p.GetNextProcess

Works only on Mac OS X.
Returns false if not supported.

Sets the lasterror property.
(Read and Write property)

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


The biggest plugin in space...