Home
Contents

Sophisticated Rename manual

Prev Page Next Page
 

External variables.

You can integrate advanced custom algorithms to the program, it is easy! External variables (externals) correspond to an external plugin which makes certain calculations and returns a text data item or several data items. To add an external variable, select menu "Tools-External Routines" in the main window. Externals are marked with "*XXV".

The following is the information for the end users of plugins. If you want to write your own plugin, please read "Creating a new plugin" section.

Plugin is an external program that allows you to add special algorythms to the Sophisticated Rename. This part of the manual describes how to use already compiled plugins that are available at the website and in the "external" subfolder of the program.

In order to integrate a DLL plugin into SR you need to create an external var in menu "tools->external routines".

Each plugin can return one or several results, it can have one or several functions inside and it may require additional information form the user. You have to specify all these parameters. A general plugin has one function and one result, these fields may be filled out automatically if the plugin supports auto-filling sr_help interface. Click [Auto/Help] to see if the plugin has this function (some easy plugins have no help and auto-filling functions). If the plugin has the sr_help interface, it will automatically fill out all the required fields and show a help message which explains how to use the plugin. Then you will need to enter a name of the external variable that will refer to the result of the plugin processing and save it by clicking the [Add] button. If the plugin has no sr_help interface, you will have to read its manual to learn the names of functions and result keys and enter them manually to the appropriate fields.

Dll name: the full name of the DLL plugin, click [Open] to find your DLL module.

Func name: the name of the main function in the dll. Note, that the function name is case sensitive, i.e. 'rs' is not equal to 'Rs'.

Result key: it refers to a certain piece of data created by the dll. Some dlls can produce only one result key, and some can generate several result strings.

Parameters: Some plugins require additional information to generate proper results. Use parameters string at the bottom of the "External Routines" window to provide additional data in the following format:

keyname1=value1|keyname2=value2|keyname3=value3

If you need to use the '|' symbol as a part of a value string, you should type it twice: '||'. For example, if you want 'regexpval' to be equal '0(4|5)', you should type 'regexpval=0(4||5)'.

Allow external caching: this function can significantly reduce the time of processing for the most of plugins if the plugin is called more than once for every single file. Still there is one case when you shouldn't use caching. It's when your external program uses some random numbers generators. If you use such a plugin, it should be executed as many times as you need to get different results.

It is effective to use this option if you use a plugin to read a certain file format, like exif jpeg: you analyse a file only once and save all data to a buffer for caching instead of analysing one and the same file several times in a row. Several external vars can get their values after one execution of an external program.

When caching is allowed, SR uses a buffer to store previous results. When an external var calls a dll program, SR saves its results to the buffer. If another external var calls the same program later, SR checks if the params are the same. If they are the same, SR doesn't call the external program and takes the results from the buffer. If an external var calls another external program (or the same program with different keys), SR executes it and updates the buffer. When all vars in the template are managed, SR clears the buffer.

Relating lessons: Lessons-E, F, G.

Go to the main page.