Storing return value

Hey together,

i am quite new to Touch and to TScript.
Maybe someone could halp me with a beginners question.

How can i strore the return of a Command into a variable?

In the Wiki i found that opcp got the flag -v to return the name of the created node.
When just running opcp -v -a item0 /project1 / the command works fine and the return value is printed into the textport.

I thought something like set newitem = `opcp -v -a item0 /project1/` would work but it didn’t.

I would like to use that name to wire it to an existing Merge Node.

Thanks for your help.

Jewe

you need to use the execute expression:

set newitem = `execute("opcp -v -a item0 /project1/")`

PS: if you want to copy to the same destination, you can also use:

set newitem = `execute("opcp -v -a item0 .")`

thank you!