
Using MediaScript 13
•
•
•
•
Example
#include "process/library.ms";
If your MediaScript uses the XMLdocument object, you need to use the #include directive
to specify the xml.ms that installs with MediaRich. Do this by adding the following line at
the beginning of your script:
#include "sys:xml.ms";
Using the #link Directive
The #link directive is a preprocessing flag that is evaluated before the script is parsed or
executed. It allows DLLs to be included as if they were part of the original script and takes
a string representing the relative path of the filename to include.
Syntax
#link <relative path to the included file>;
Example
#link <process/library.dll>;
If your MediaScript uses the Database, Cursor, or Stproc object, it must include the
following line at the beginning of the script:
#link <Database.dll>;
Named Arguments
When reading the object reference section of this chapter, you will see that many of the
Media object's methods use an argument notation of the form:
argName @ argValue
The reason for this notation is that these methods often have a long list of optional (and
sometimes mutually exclusive) arguments. The save() method, for example, has sixteen
arguments, many of which only apply to certain file formats. Moreover, adding a new file
format plug-in to the system can add even more arguments. Because of this, certain
methods take a set of name/value pairs rather than the standard positional argument list.
MediaScript introduces the at operator (@) to simplify named arguments, as in the
following:
(argName1 @ argValue1, argName2 @ argValue2, …)
For example, if you have a Media object named “img” and you want to save the contents
to a JPEG file named “out.jpg” at 90% quality, the MediaScript looks like the following:
img.save(name @ "out.jpg", quality @ 90);