Platforms to show: All Mac Windows Linux Cross-Platform
NSUserUnixTaskMBS class
Super class: NSUserScriptTaskMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Tasks | MBS MacExtras Plugin | 16.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
These classes are intended to execute user-supplied scripts, and will execute them outside of the application's sandbox, if any. (They are *not* intended to execute scripts built into an application; for that, use NSTaskMBS, NSAppleScript classes, or AMWorkflow classes.) If the application is sandboxed, then the script must be in the "application scripts" folder, which you can get using ScriptFolder function. A sandboxed application may read from, but not write to, this folder.
If you simply need to execute scripts without regard to input or output, use NSUserScriptTaskMBS, which can execute any of the specific types. If you need specific control over the input to or output from the script, use one of the sub-classes, which have more detailed "execute" methods.
The script should have a valid file extension like ".sh" and the executable bit set (chmod +x) to be able to run. First line of the script should have the shebang line like "#!/bin/bash" and line endings should be Chr(10) as in EndOfLine.Unix.
Subclass of the NSUserScriptTaskMBS class.
- 3 properties
- property standardError as NSFileHandleMBS
- property standardInput as NSFileHandleMBS
- property standardOutput as NSFileHandleMBS
- 3 methods
- method Constructor(file as folderitem, byref error as NSErrorMBS)
- method Constructor(URL as String, byref error as NSErrorMBS)
- method executeWithArguments(arguments() as string, tag as Variant = nil)
Super class NSUserScriptTaskMBS
- event executeFinished(error as NSErrorMBS, tag as Variant, result as Variant, input as Variant)
- 2 properties
- 3 methods
- method Constructor(file as folderitem, byref error as NSErrorMBS)
- method Constructor(URL as String, byref error as NSErrorMBS)
- method execute(tag as Variant = nil)
- 2 shared methods
- shared method Available as Boolean
- shared method ScriptFolder as FolderItem
This class has no sub classes.
Blog Entries
Release notes
- Version 22.1
- Changed NSUserUnixTaskMBS class constructor to not raise exception, so you can check error parameter easier.
- Version 17.2
- Changed NSUserUnixTaskMBS properties for file handles to be writable.
The items on this page are in the following plugins: MBS MacExtras Plugin.
NSUserScriptTaskMBS - NSUUIDMBS