Thursday, March 28, 2019

18. OS execute

We can run commands using OS.execute function.


The root node is a Node with sole child, a Label.


This script is attached to the Node.



extends Node

var label

func _ready():
    label= get_node("Label")
    label.align = Label.ALIGN_CENTER
    label.valign = Label.VALIGN_CENTER
    var output = []
    var pid = OS.execute('csound', ["--version"], true, output)
    var result = ""
    for i in range(122):
        result += output[0][i]
    label.set_text(result) 


We assume that csound is installed on the system. This is the first 122 characters on my version:


No comments:

Post a Comment