Library for user scripts

Post Reply
krzychol
Posts: 9
Joined: Tue Sep 14, 2010 10:41 pm

Library for user scripts

Post by krzychol »

I was wondering whether it's possible to have some of my scripts (Pascal functions) stored in one place, so that they could be used in many places of WMS.

Maybe it's going to be easier with an example...

I have several collections that are generated automatically using a script.
There's a separate collection for movies added to the library in last week, last month, last 3 months.
The only thing that is different in those scripts is the number of days since the movie has been added.
So what I did is I wrote a script that finds such movies and copied that script in 3 different collections (with only one thing being different - number of days sine media item has been added).

What happens now is that whenever I need to change something in the way movies are found within the library, I need to change the same script 3 times instead of doing this only once.

For me the best would be if I could do something like (sort of pseudo-code below):

Code: Select all

Script1:
import (myFunction(int noDays))
myFunction(7);

Script2:
import (myFunction(int noDays))
myFunction(30);

Script3:
import (myFunction(int noDays))
myFunction(90);
Do you think something like that is even possible in PascalScript?
Maybe in other language supported by WMS - language is not a problem - the only thing is, I'd love to be able to import functions from some kind of general library of user functions...
Eugene
Posts: 2940
Joined: Tue Nov 17, 2009 8:05 pm

Re: Library for user scripts

Post by Eugene »

http://www.fast-report.com/pbc_download/files/fs_en.pdf

Code: Select all

uses 'c:\temp\test.pas';

begin
  A
end. 
c:\temp\test.pas

Code: Select all

procedure A;
begin
  ShowMessage('A')
end;

begin

end.
krzychol
Posts: 9
Joined: Tue Sep 14, 2010 10:41 pm

Re: Library for user scripts

Post by krzychol »

Great!
Exactly what I needed - works perfectly.
Post Reply