Using Variables in a script

  • Last Post 13 May 2022
marcwibbs posted this 12 May 2022

Hi DN buds

I am trying to create a workflow where files are placed into a watch folder, from there a 'data export' lists all the file names (attached D1).

The files are sent to a watch folder and 'data output' as xml as well as the files themselves (d2)

A script kicks in to merge the files together to form an xml output (d3)


This all works except for 1 element, I would  like to use the "WATCHFOLDERSUBPATH" variable in the script to be able to populate the script to replace the "400" with the variable (see example xml and script below)



<?xml version="1.0" encoding="UTF-8" ?>



<UserName>Marc Wilmington</UserName>

<ScanStartDateTime>5/12/20229:16 AM</ScanStartDateTime>

<ScanEndDateTime>5/12/20229:16 AM</ScanEndDateTime>








<Document>ferhj - Copy</Document>


<Document>ffrrffj - Copy</Document>














Dim strInputPath1, strInputPath2, strInputPath3, strOutputPath

Dim txsInput1, txsInput2, txsInput3, txsOutput



Set FSO = CreateObject("Scripting.FileSystemObject")


strInputPath1 = "C:\Output\CPS\KM\400\KM_400.txt"

strInputPath2 = "C:\Output\CPS\KM\400\400.txt"

strInputPath3 = "C:\KMDonotDelete\CPS\XML_File_End\XMLEnd.txt"

strOutputPath = "C:\Output\CPS\KM\400\Final\KMCPS40.xml" 

' For the timestamp I use Now (today's date). Can also choose some other date. 


Set txsInput1 = FSpenTextFile(strInputPath1, 1)

Set txsInput2 = FSpenTextFile(strInputPath2, 1)

Set txsInput3 = FSpenTextFile(strInputPath3, 1)

Set txsOutput = FSO.CreateTextFile(strOutputPath)


txsOutput.Write txsInput1.ReadAll

txsOutput.Write txsInput2.ReadAll

txsOutput.Write txsInput3.ReadAll








I'm just unsure of how to declare Doc Nav variables in the script.






Attached Files

luca.scarpati posted this 13 May 2022

Hi Marc,


maybe it is not the best way in general to write a "code" inside the normal message of a forum, also because in addition to being public it is then encoded with emoticons wink


If I understand correctly you need the call for the internal CALLs to our scripting engine:

  • VBS:
    • yourvar = Metadata.Values("YOURVARIABLE") -> It returns the value of a variable inside the script, in your case maybe you can use WATCHFOLDERSUBPATH
    • call Metadata.SetValues("MYVAR", yourvar) -> It updates/creates the value of a server variable
  • JS:
    • yourvar = Metadata.Values("YOURVARIABLE");
    • Metadata.SetValues("MYVAR", myvar);

However here you can find all the information about the scripts cool


Have a nice day!

Best regards,