Platforms to show: All Mac Windows Linux Cross-Platform

NSProcessInfoMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Process MBS MacBase Plugin 8.4 ✅ Yes ❌ No ❌ No ✅ Yes All
The NSProcessInfo class provides methods to access information about the current process.

Each process has a single, shared NSProcessInfo object, known as process information agent.

The process information agent can return such information as the arguments, environment variables, host name, or process name. The processInfo class method returns the shared agent for the current process—that is, the process whose object sent the message. For example, the following line returns the NSProcessInfo object, which then provides the name of the current process:

dim processInfo as new NSProcessInfoMBS
dim processName as string = processInfo.processName

The NSProcessInfo class also includes the operatingSystem method, which returns an enum constant identifying the operating system on which the process is executing.

NSProcessInfo objects attempt to interpret environment variables and command-line arguments in the user's default C string encoding if they cannot be converted to Unicode as UTF-8 strings. If neither conversion works, these values are ignored by the NSProcessInfo object.

For Windows, please check WindowsThreadExecutionStateMBS to prevent system sleep.

Constants

Constant Value Description
NSHPUXOperatingSystem 4 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the HP UX operating system.
NSMACHOperatingSystem 5 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the Mac OS X operating system.
Example
NSOSF1OperatingSystem 7 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the OSF/1 operating system.
NSSolarisOperatingSystem 3 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the Solaris operating system.
NSSunOSOperatingSystem 6 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the Sun OS operating system.
NSWindows95OperatingSystem 2 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the Windows 95 operating system.
NSWindowsNTOperatingSystem 1 One of the following constants are provided by the NSProcessInfo class as return values for operatingSystem. Indicates the Windows NT operating system.

Activity Options

Constant Value Description
NSActivityAutomaticTerminationDisabled &h8000 Flag to prevent automatic termination.
Available in OS X v10.9 and later.
NSActivityBackground &h000000FF Flag to indicate the app has initiated some kind of work, but not as the direct result of user request.
Available in OS X v10.9 and later.
NSActivityIdleDisplaySleepDisabled &h10000000000 Flag to require the screen to stay powered on.
Available in OS X v10.9 and later.
NSActivityIdleSystemSleepDisabled &h100000 Flag to prevent idle sleep.
This is included in NSActivityUserInitiatedAllowingIdleSystemSleep.
Available in OS X v10.9 and later.
NSActivitySuddenTerminationDisabled &h4000 Flag to prevent sudden termination.
This is included in NSActivityUserInitiatedAllowingIdleSystemSleep.
Available in OS X v10.9 and later.
NSActivityUserInitiated &h00FFFFFF Flag to indicate the app is performing a user-requested action.
Available in OS X v10.9 and later.
NSActivityUserInitiatedAllowingIdleSystemSleep &h00EFFFFF Flag to indicate the app is performing a user-requested action, but that the system can sleep on idle.
Available in OS X v10.9 and later.

Thermal State Constants

Constant Value Description
NSProcessInfoThermalStateCritical 3 System performance is significantly impacted and the Mac needs to cool down. Recommendation: reduce application's usage of CPU, GPU, and I/O to the minimum level needed to respond to user actions. Consider stopping use of camera and other peripherals if your application is using them.
NSProcessInfoThermalStateFair 1 The system has reached a state where fans may become audible.
NSProcessInfoThermalStateNominal 0 No corrective action is needed.
NSProcessInfoThermalStateSerious 2 Fans are running at maximum speed, system performance maybe impacted. Recommendation: reduce application's usage of CPU, GPU and I/O, if possible. Switch to lower quality visual effects, reduce frame rates.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 24.1
    • Added NSProcessInfoPowerStateDidChangeNotification for NSProcessInfoMBS class.
  • Version 23.5
    • Fixed isiOSAppOnMac and isLowPowerModeEnabled properties in NSProcessInfoMBS class to work in iOS target.
  • Version 21.3
  • Version 21.0
  • Version 18.5

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


NSProcessInfoActivityMBS   -   NSProgressIndicatorMBS


The biggest plugin in space...