RTTSoftware Support Forum

PDF-ShellTools => General => Topic started by: robg on May 22, 2014, 05:05:07 AM

Title: Run MyScripts via Command Line/DLL & delete original files
Post by: robg on May 22, 2014, 05:05:07 AM
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
Title: Re: Run MyScripts via Command Line/DLL & delete original files
Post by: RTT 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.
Title: Re: Run MyScripts via Command Line/DLL & delete original files
Post by: robg 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.