Lua scripting

I want Orthanc to auto route dicom files to a specific directory in my computer. I don’t know what parameter I have to put in the quotes written sample below so that the files will be routed to my desired directory:

function OnStoredInstance(instanceId, tags, metadata)
SendToModality(instanceId, ‘sample’)
end

Have tried to put the path to the directory but nothing is working. I am only reiving the error that it Couldn’t read data from file “route_dicoms.lua”.

How can I solve this?

That script is used to auto route to another DICOM modality. You would need to use something like the WriteToDisk.lua which is included in the Orthanc source code.

https://hg.orthanc-server.com/orthanc/file/tip/OrthancServer/Resources/Samples/Lua/WriteToDisk.lua