Platforms to show: All Mac Windows Linux Cross-Platform
/MacCocoa/NSProcessInfo Example
Required plugins for this example: MBS Main Plugin, MBS MacCocoa Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCocoa/NSProcessInfo Example
This example is the version from Tue, 3rd Aug 2015.
Project "NSProcessInfo Example.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
#pragma BreakOnExceptions false
dim p as NSProcessInfoMBS = new NSProcessInfoMBS
List.AddRow "processname", p.processName
List.AddRow "hostName", p.hostName
List.AddRow "processIdentifier", str(p.processIdentifier)
List.AddRow "globallyUniqueString", p.globallyUniqueString
List.AddRow "operatingSystem", str(p.operatingSystem) // always 5 for Mac OS X
List.AddRow "operatingSystemName", p.operatingSystemName
List.AddRow "operatingSystemVersionString", p.operatingSystemVersionString
try
// 10.5 or newer
List.AddRow "processorCount", str(p.processorCount)
List.AddRow "activeProcessorCount", str(p.activeProcessorCount)
List.AddRow "physicalMemory", str(p.physicalMemory)
catch n as NSExceptionMBS
// ignore
end try
try
// 10.6 or newer
List.AddRow "systemUptime", str(p.systemUptime)
catch n as NSExceptionMBS
// ignore
end try
dim u as integer = p.argumentsCount-1
for i as integer = 0 to u
List.AddRow "Argument("+str(i)+")", p.argument(i)
next
dim dic as Dictionary = p.environment
for each key as Variant in dic.keys
List.AddRow key, dic.Value(key)
next
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCocoa Plugin.