I need to export some documents from a LN database to files on an external disc. I can do it one time using @formula:
@Command( [FileExport] ; "Microsoft RTF"; "c:\\"+@Text(@DocumentUniqueID)+".rtf")
This formula save a document with unique name on disc C:
for example c:\D120DC8BEEF7E264C125775200583307.rtf
However it's a manually work. I have to open each one document and press a button with this formula attached.
I would like to write an agent which I can run background on the server. This task will be run every 1h to check if a new document appear and export it.
Is this possible? How to write the code?
I tried to use Evaluate statement but it doesn't work.
Here is a part of my code (it's a loop for all documents in the View1):
For i =1 To how_many
Set Doc1 = View1.GetFirstDocument
Call Workspace.EditDocument( False, Doc1)
formula_string$ = "@Command( [FileExport] ; ""Microsoft RTF""; ""c:\\"+Doc1.UniversalID+".rtf"")"
varia1 = Evaluate(formula_string$,Doc1)
Unfortunatelly it doesn't work. I would be grateful for help.
As I wrote I need the task which I can run background on server. I am note sure if it possible. Maybe FileExport require open LN session with GUI. What with file destination (for example "C:") if it will be run background on server?