Execute Script
Octory PRO
Element type: Dictionary
This actions takes a script path to execute and execute it, passing it arguments if specified. This script will be executed with root rights thanks to the Helper.
Keys
Name | Type | Possible values | Required |
---|---|---|---|
Type | String | ExecuteScript | Required |
ScriptPath | String | - | Required |
Arguments | Array (String) | - | |
Variable | String | - | |
Condition | Dictionary (Condition) | - |
Detail
Type Required
Type: String
Explanation: The type of the action has to be ExecuteScript
.
ScriptPath Required
Type: String
Explanation: The path to the script to execute
Arguments
Type: Array(String)
Explanation: Specify here all the arguments needed for the command Note that you can write several arguments in one string. It’s up to your preference. When writing several arguments in one string, you have to respect the classic quoting when specifying paths with spaces. Don’t hesitate to use another string in the array for large arguments
Variable
Type: String
Explanation: When specified, the output of the command will be stored inside a variable with the given name.
Condition
Type: Dictionary (Condition)
Explanation: Allows launch the action only based on a boolean expression.
Example
The following example will execute a script which takes an argument and rename the computer based on this argument. The variable UserChoiceComputerName
can be asked to the user with a Text input component.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- ... -->
<key>ActionSets</key>
<array>
<dict>
<key>Type</key>
<string>Parallel</string>
<key>Triggers</key>
<array>
<string>NextButtonClick</string>
</array>
<key>Actions</key>
<array>
<dict>
<key>Type</key>
<string>ExecuteScript</string>
<key>ScriptPath</key>
<string>${ScriptsFolder}/changeComputerName.sh</string>
<key>Arguments</key>
<array>
<string>${UserChoiceComputerName}</string>
</array>
</dict>
</array>
</dict>
</array>
<!-- ... -->
</dict>
</plist>