RunTask.NewTask
---------------

Creates a new task.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [RunTask](component_RunTask.md) | [3.1](newinversion31.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

### Deprecated

This function was [deprecated](deprecated.md). Use [Shell](component_Shell.md) functions instead.

MBS( "RunTask.NewTask" ) ### Parameters

none

### Result

Returns OK or error.

### Description

Creates a new task.  
Clears all properties, so you can start fresh.  
  
Please use [Shell.New](ShellNew.md) if you need more features.  
### Examples

Run ls on Mac:

 # new task   
Set Variable \[$r ; Value:MBS ( "RunTask.NewTask" )\]  
\#set launch path and arguments   
Set Variable \[$r ; Value:MBS ( "[RunTask.SetLaunchPath](RunTaskSetLaunchPath.md)"; "/bin/ls" )\]  
Set Variable \[$r ; Value:MBS ( "[RunTask.SetArguments](RunTaskSetArguments.md)"; "/bin" )\]  
\# run   
Set Variable \[$r ; Value:MBS ( "[RunTask.Launch](RunTaskLaunch.md)")\]  
\# wait   
Loop  
 Pause/Resume Script \[Duration (seconds): ,1\]  
 Exit Loop If \[MBS ( "[RunTask.IsRunning](RunTaskIsRunning.md)" ) ≠ 1\]  
End Loop  
\# read result   
Set Variable \[$data ; Value:MBS ( "[RunTask.ReadOutputText](RunTaskReadOutputText.md)"; "UTF-8" )\]  
Show Custom Dialog \["Result"; $data \]  
Run shell script in bash:

 Set Variable \[$r ; Value:MBS ( "RunTask.NewTask" )\]  
Set Variable \[$r ; Value:MBS ( "[RunTask.SetLaunchPath](RunTaskSetLaunchPath.md)"; "/bin/bash" )\]  
Set Variable \[$r ; Value:MBS ( "[RunTask.SetArguments](RunTaskSetArguments.md)"; "/Users/cs/Desktop/test.sh"; "First Param" )\]  
Set Variable \[$r ; Value:MBS ( "[RunTask.Launch](RunTaskLaunch.md)")\]  
### See also

- [RunTask.IsRunning](RunTaskIsRunning.md)
- [RunTask.Launch](RunTaskLaunch.md)
- [RunTask.ReadErrorText](RunTaskReadErrorText.md)
- [RunTask.ReadOutputText](RunTaskReadOutputText.md)
- [RunTask.SetArguments](RunTaskSetArguments.md)
- [RunTask.SetLaunchPath](RunTaskSetLaunchPath.md)
- [RunTask.Wait](RunTaskWait.md)
- [Shell.New](ShellNew.md)
- [URLScheme.SetDefaultHandler](URLSchemeSetDefaultHandler.md)

### Example Databases

- [Shell/RunTask/Run Shell Script on Mac](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/RunTask/Run%20Shell%20Script%20on%20Mac.shtml#1ScriptAnchor_)
- [Shell/RunTask/RunTask Windows](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/RunTask/RunTask%20Windows.shtml#1ScriptAnchor_)
- [Shell/RunTask/RunTask with read and write on Mac](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/RunTask/RunTask%20with%20read%20and%20write%20on%20Mac.shtml#1ScriptAnchor_)
- [Shell/RunTask/RunTask](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Shell/RunTask/RunTask.shtml#1ScriptAnchor_)

### Blog Entries

- [Tip of the day: Query connected clients on FileMaker Server by script](https://www.mbsplugins.de/archive/2016-08-17/Tip_of_the_day_Query_connected/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 13th June 2020

  
[RunTask.Launch](RunTaskLaunch.md) - [RunTask.ProcessIdentifier](RunTaskProcessIdentifier.md)

[HTML Version](RunTaskNewTask.shtml)