Author Topic: Run MyScripts via Command Line/DLL & delete original files  (Read 6486 times)

0 Members and 1 Guest are viewing this topic.

robg

  • Newbie
  • *
  • Posts: 4
Hi, 2 questions:

1. I've written quite a complex script with the context menu scripts editor, which it works great, but I would really like to invoke this from the command line interface.
Is it possible to run my custom scripts from Command Line/DLL?

2. In my script I'm creating a new merged file. How can I get it to delete the original files when I'm done with them? At the moment I get a file permissions error.

Thanks!

Rob

RTT

  • Administrator
  • *****
  • Posts: 918
Re: Run MyScripts via Command Line/DLL & delete original files
« Reply #1 on: May 22, 2014, 03:55:20 PM »
Quote
1. I've written quite a complex script with the context menu scripts editor, which it works great, but I would really like to invoke this from the command line interface.
Is it possible to run my custom scripts from Command Line/DLL?
Something that needs to be developed. I will try to add it to the next release.
Quote
2. In my script I'm creating a new merged file. How can I get it to delete the original files when I'm done with them? At the moment I get a file permissions error.
The MergeDocument function keeps the document open and only releases it after a new document is merged or the EndAndSaveTo function is called. If you are merging documents in a loop, you may use this strategy.
Code: [Select]
for (){
...
Merger.MergeDocument(Filename);
if (prevFilename) DeleteFile(prevFilename);
prevFilename = Filename;
....
}
Merger.EndAndSaveTo(NewFilename);
if (prevFilename) DeleteFile(prevFilename);

Or you can just keep a list of the documents to delete and do it after you are done with the merger.

robg

  • Newbie
  • *
  • Posts: 4
Re: Run MyScripts via Command Line/DLL & delete original files
« Reply #2 on: July 21, 2014, 02:24:42 AM »
Quote
Or you can just keep a list of the documents to delete and do it after you are done with the merger.

Thanks - I went with this option.