System¶
7 nodes. Types ending in [] are lists. An input with a default is optional.
Nodes¶
Graph.Folder¶
The folder of the graph file, which is where a relative path in a file node starts (for a graph that was never saved: Documents\CamelGraph; in the Script Player and the command line: the folder of the script). Combine it with a file name using Path.Join to build a path that works wherever the graph and its files are moved together.
No inputs.
Outputs
| Output | Type | What it gives |
|---|---|---|
folder |
string |
The full path of the graph's folder. |
Tags: graph folder directory location relative portable script folder next to graph
System.Environment¶
Reports the Windows user, computer name, operating system and the current, temp, Documents and AppData folders. currentDirectory is the folder of the running program (for Navisworks its install folder), not the folder of the graph: use Graph.Folder for that.
No inputs.
Outputs
| Output | Type |
|---|---|
userName |
string |
machineName |
string |
osVersion |
string |
currentDirectory |
file |
tempPath |
file |
documentsPath |
file |
appDataPath |
file |
Returns: Dictionary with "userName", "machineName", "osVersion", "currentDirectory", "tempPath", "documentsPath" and "appDataPath".
Tags: user username machine computer os windows temp documents appdata folder whoami
System.OpenPath¶
Opens a file or folder with its default application, or shows it selected in Explorer when reveal is true. A relative path starts in the graph's folder.
Inputs
| Input | Type | Default | What it does |
|---|---|---|---|
path required |
string |
— | The file or folder to open. A relative path starts in the graph's folder. |
reveal |
boolean |
false |
True to show the item in Explorer (Windows) / open its containing folder (other systems) instead of opening it. |
Outputs
| Output | Type | What it gives |
|---|---|---|
path |
string |
The path that was opened, for sequencing further nodes. |
Tags: open explorer reveal show launch folder default app finder
System.Run¶
Runs a program with arguments, waits for it (stopped after Advanced > timeoutSeconds, 60 by default) and returns its exit code, output and error text. A bare program name is searched on the PATH; a path with folders that is not a full path starts in the graph's folder. Advanced > workingDirectory chooses the folder it runs in. In a loop, wire the loop item (or something made from it) into arguments: a node with only fixed inputs belongs to no loop and runs once.
Inputs
| Input | Type | Default | What it does |
|---|---|---|---|
executable required |
string |
— | The program to start: a full path, or a name found on the PATH. A path with folders that is not full starts in the graph's folder. |
arguments |
string |
"" |
The command-line arguments as one string. |
workingDirectory |
string |
"" |
The folder to run in; empty uses the folder of the running program (for Navisworks its install folder). |
timeoutSeconds |
integer |
60 |
How long to wait before stopping the program (1 to 3600 seconds). |
Outputs
| Output | Type |
|---|---|
exitCode |
integer |
output |
string |
error |
string |
Returns: Dictionary with "exitCode", "output" (standard output) and "error" (standard error).
Tags: run execute process command exe cmd shell script launch
Web.Download¶
Downloads a file (IFC, BCF, zip, picture, anything) from an http(s) address and saves it byte for byte; missing folders are created and an existing file is only replaced when overwrite is true. The file is received beside the target and put in place when complete, so a failed or too slow download leaves nothing half-written. An error status such as 404 is returned (ok = false, path empty) and writes nothing; a network failure or timeout is an error. A relative path starts in the graph's folder.
Inputs
| Input | Type | Default | What it does |
|---|---|---|---|
url required |
string |
— | The address, starting with http:// or https://. |
path required |
string |
— | The file to write. A relative path starts in the graph's folder; missing folders are created. |
overwrite |
boolean |
false |
True to replace an existing file; false (default) to fail instead. |
headers |
IDictionary |
null |
Optional request headers (name to value), e.g. an Authorization token. |
timeoutSeconds |
integer |
120 |
How long the whole download may take (1 to 3600 seconds). |
Outputs
| Output | Type |
|---|---|
path |
file |
status |
integer |
ok |
boolean |
sizeBytes |
number |
Returns: Dictionary with "path" (the file written, null when the answer was an error), "status" (HTTP code), "ok" (true for 2xx) and "sizeBytes".
Tags: download http https fetch file save ifc zip bcf url web get file
Web.Get¶
Downloads text from an http(s) address with GET; an error status such as 404 is returned (ok = false), only a network failure or timeout is an error. The body is decoded as text, so use Web.Download for files such as IFC, zip or pictures.
Inputs
| Input | Type | Default | What it does |
|---|---|---|---|
url required |
string |
— | The address, starting with http:// or https://. |
headers |
IDictionary |
null |
Optional request headers (name to value), e.g. an Authorization token. |
timeoutSeconds |
integer |
30 |
How long to wait for the answer (1 to 600 seconds). |
Outputs
| Output | Type |
|---|---|
status |
integer |
body |
string |
ok |
boolean |
Returns: Dictionary with "status" (HTTP code), "body" (response text) and "ok" (true for 2xx).
Tags: http https request download api rest url fetch json web
Web.Post¶
Sends data to an http(s) address with POST (JSON by default, e.g. a Teams or Slack web hook); an error status is returned (ok = false), only a network failure or timeout is an error.
Inputs
| Input | Type | Default | What it does |
|---|---|---|---|
url required |
string |
— | The address, starting with http:// or https://. |
body required |
any |
— | The data to send: text as it is; anything else becomes JSON when the content type contains "json". Nothing wired sends an empty body. |
contentType |
string |
"application/json" |
The Content-Type of the body; defaults to application/json. |
headers |
IDictionary |
null |
Optional request headers (name to value), e.g. an Authorization token. |
timeoutSeconds |
integer |
30 |
How long to wait for the answer (1 to 600 seconds). |
Outputs
| Output | Type |
|---|---|
status |
integer |
body |
string |
ok |
boolean |
Returns: Dictionary with "status" (HTTP code), "body" (response text) and "ok" (true for 2xx).
Tags: http https post send webhook teams slack api rest json notify upload