Creating text in a scriptDAT

Is there a good way to populate a scriptDAT with text instead of a table that doesn’t involve copying another textDAT?

If you try to do this:

def onCook(scriptOp):
   scriptOp.text = 'some stuff\nand things'

It converts it to a table with two rows instead of text.

The only way that I’ve found that works is to have an empty textDAT feeding into it, and use it like this:

def onCook(scriptOp):
   scriptOp.copy(scriptOp.inputs[0])
   scriptOp.text = 'some stuff\nand things'

But it would be nice to not have to have those empty textDATs to coerce it into treating the contents as text. There is an isText property, but it is read-only.

I think what you want is the .write() method. For example:

def onCook(scriptOp):
	scriptOp.clear()
	scriptOp.write("Hello world \nThe thing about DAT's is \nthey're really cool")
	return

Which returns a result like this:

2 Likes

Exactly what I was looking for.
Thanks!

1 Like