Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSProcessInfoMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class Process MBS Cocoa Plugin 8.4 Yes No No Yes, macOS only No
Function: The NSProcessInfo class provides methods to access information about the current process.
Notes:
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.

Feedback, Comments & Corrections

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 which use this class:


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


NSProcessInfoActivityMBS   -   NSProgressIndicatorMBS




Links
MBS Xojo Plugins