Here is the list of Function
available on MagicScript:
MagicScript Language Function Reference
Special Function Reference
The
#WEBQUERY# Instruction
Contains the query for question the Movie's Website.
Syntax:
#WEBQUERY#=text#MOVIE#text
Parameters:
|
text |
Required.
The text of the proper query for access a web-site. |
|
#MOVIE# |
Optional.
Is the CONSTANT that contain the Title of the movie you are looking for. |
Examples:
1. #WEBQUERY#=http://imdb.com/Tsearch?title=#MOVIE#&restrict=Movies+only
The Engine will replace the Variable #MOVIE# with the title of it, so it can make the query to the web.
Remarks:
You can put this
instruction where you want in the Script, but only ONCE (if
there are more of this instruction, Engine will take the
first)
Note that if you didn't write the CONSTANT #MOVIE#, you will
probably find nothing from web.
Script
Function Reference | Top
The
#STARTREADWEB# Instruction
Reset the Read Engine to the first line of HTML and set the CURSOR Variable to 1.
Syntax:
#STARTREADWEB#
Parameters:
This Instruction Tell to engine that you want start your search to the top of the HTML file.
Remarks:
It's
recommended that you put this instruction in all Blocks for
re-initializing the Engine. If you read the title of a movie
that is at the bottom of the HTML file, and then read the
Director that is at the top,you will not find Director's info
if you didn't re-initialize the engine with this instruction
.
Script
Function Reference | Top
The
#FINDLINE# Function
Search for a string in all HTML page.
Syntax:
#FINDLINE#=text#??##ONERROR#=*options*
Parameters:
|
text |
Required.
The text to find in the HTML. |
|
#??# |
Required.
The number of Variable where Function store the result of the Search.
If the text is found, the variable will contain value 1 , if no text
is found, value 0 |
|
#ONERROR#=*options* |
Optional.
In the options you can specify what Engine must do in case of ERROR
of the Function :
STOP -> Will terminate the BLOCK where is the Function.
ASK -> Will show you the message of error and the
script-line where is located
OK -> Will ignore the error and go on with
executing the others functions |
Examples:
1. #FINDLINE#=<title>#12##ONERROR#=*STOP*
2. #FINDLINE#=<title> #01##ONERROR#=*ASK*
Note that these two functions search for different strings! the first search "<title>", Second the String "<title> " .Be careful!
This Instruction is useful when you want to search for a particular string in the whole HTML , but you don't know where it is. It is different from the #FIND#
function that searches for a string only in the CURRENT Line of HTML. To know the the position in the string where is text you are looking for begin,
you can use the CURSOR Variable.
Remarks:
This
function writes on the main variable CURSOR the position
where the string you are searching starts. Remember that all
others functions start to
search text from the position of the CURSOR variable!.
Script
Function Reference | Top
The
#FIND# Function
Search for a string only in the CURRENT LINE of HTML page.
Syntax:
#FIND#=text#??##ONERROR#=*options*
Parameters:
|
text |
Required.
The text to find in the HTML. |
|
#??# |
Required.
The number of Variable where Function store the result of the Search.
If the text is found, the variable will contain his position , if no text
is found, value 0 |
|
#ONERROR#=*options* |
Optional.
In the options you can specify what Engine must do in case of ERROR
of the Function :
STOP -> Will terminate the BLOCK where is the Function.
ASK -> Will show you the message of error and the
script-line where is located
OK -> Will ignore the error and go on with
executing the others functions |
Examples:
1. #FIND#=<title>#12##ONERROR#=*ASK*
2. #FIND#=<title> #12##ONERROR#=*OK*
Note that these two functions search for different strings! the first searches "<title>", the Second the String "<title> " .Be careful!
This Instruction is similar to the #FINDLINE#, but searches for the text only in the current line of HTML.
Remarks:
This
function writes also on the main variable CURSOR the position
where the string you search starts. remember that all other
functions start to
search text from the position of the CURSOR variable.
Script
Function Reference | Top
The
#TAKEWORD# Function
Takes a string from the current line;
Syntax:
#TAKEWORDLEN#=#?1#,#?2#,#?3#
Parameters:
|
#?1# |
Required.
The Variable where is the Text Extracted. |
|
#?2# |
Required.
The Variable of starting point of the Text to extract. |
|
#?3# |
Required.
The Variable of ending point of the Text to extract. If you set this = "0",
you will take all the line! |
Examples:
1. #TAKEWORD#=#03#,#01#,#02#
This Example takes a string from CURRENT LINE, starting from the position stored on variable #01# through #02# , and puts the text in the #03# Variable.
Remarks:
This
function is fundamental for working with strings, it doesn't
modify the CURSOR Variable.
Script
Function Reference | Top
The
#TAKEWORDLEN# Function
Takes a string from the current line;
Syntax:
#TAKEWORDLEN#=#?1#,#?2#,#?3#
Parameters:
|
#?1# |
Required.
The Variable where is the Text Extracted. |
|
#?2# |
Required.
The Variable of starting point of the Text to extract. |
|
#?3# |
Required.
The length of the string to extract. |
Examples:
1. #TAKEWORD#=#03#,#01#,#02#
This Example take a string LONG #02# from CURRENT LINE, starting at position stored on variable #01#, and puts the text in the #03# Variable.
Remarks:
This
function is fundamental for working with strings, it doesn't
modify the CURSOR Variable.
Script
Function Reference | Top
The
#READNEXTLINE# Instruction
Read the next line of HTML and set the CURSOR Variable to 1;
Syntax:
#READNEXTLINE#
Parameters:
Remarks:
This instruction is useful when
you have found a particular thing with #FINDLINE# instruction and you want
analyze the text line
by line.
Script
Function Reference | Top
The
#STRING# Function
Puts a string into a variable , the string can contain text and variables.
Syntax:
#STRING#=#?1#=[Text1][#?2#]{Text#??#}
Parameters:
|
#?1# |
Required.
The Variable where put the string. |
|
Text1, Text ... |
Optional.
The Text you want put in the string. |
|
#??# |
Optional.
The Variable you want put in the string at the particular position. |
Examples:
1. #PUT#=www.emuitalia.com/#01#
#PUT#=aletsg/#02#
#STRING#=#04#=http:/#01##02#divxmanager/
This Example put in the Variable #04# the text "http://www.movieplayer.it/divxmanager/" that is formed of various text and variables .
Remarks:
With this
function you can build your strings before sending it to the
Engine.
Script
Function Reference | Top
The
#PUT# Function
Puts a text or a number into a variable.
Syntax:
#PUT#=Text#??#
Parameters:
|
Text |
Required.
The Text (or number) you want put into the variable. |
|
#??# |
Required.
The Variable where put the text. |
Examples:
1. #PUT#=mytext#02#
This Example put in the Variable #02# the text "mytext".
Remarks:
Remember that your text must be
inside "="<-and first->"#" : the function
#PUT#=text#02#
is different from
#PUT#=text #02#
!.
Script
Function Reference | Top
The
#SETCURSOR# Function
Puts a value in the CURSOR Variable.
Syntax:
#SETCURSOR#=number
Parameters:
|
number |
Required.
The number you want put into the CURSOR variable. |
Examples:
1. #SETCURSOR#=12
This Example puts in the value 12 in the CURSOR variable.
Script Function Reference | Top
The
#COMPUTECURSOR# Function
Makes a SUM or SUBTRACTION to the CURSOR variable.
Syntax:
#COMPUTECURSOR#=±number
Parameters:
|
± |
Required.
Is the operation you want make. |
|
number |
Required.
Is the Value to SUM or SUBTRACT |
Examples:
1. #COMPUTECURSOR#=+2
This Example sum to the value of CURSOR "2".
Script Function Reference | Top
The
#PUTCURSOR# Function
Puts the value of CURSOR into a variable.
Syntax:
#PUTCURSOR#=#??#
Parameters:
|
#??# |
Required.
The Variable where put the value of CURSOR. |
Examples:
1. #PUTCURSOR#=#01#
This Example puts in the CURSOR into #01# variable.
Script
Function Reference | Top
The
#COMPUTEVAR# Function
Puts the value of CURSOR into a variable.
Syntax:
#PUTCURSOR#=#??#
Parameters:
|
#??# |
Required.
The Variable where put the value of CURSOR. |
Examples:
1. #PUTCURSOR#=#01#
This Example puts in the CURSOR into #01# variable.
Script
Function Reference | Top
The
#CONDITIONRIGHTPAGE# Special Function
Specifies if you
have found directly the page of a movie.
Syntax:
#CONDITIONRIGHTPAGE# #?1#==#?2#
Parameters:
|
#?1# |
Required.
The first variable to compare. |
|
#?2# |
Required.
The second variable to compare. |
|
== |
Required.
The Operator. It can assume this value :
"==" this means "Equal To"
"<>" this means "Different to" |
Examples:
1. #CONDITIONRIGHTPAGE# #03#<>#04#
Here the page you found is directly of the movie if value of #03# variable is different from value of #04#.
Remarks:
You can
use with this function only Variables, so if you need to compare a variable with
a string, first you must #PUT# you string in another variable and then compare.
Script
Function Reference | Top
The
#WRITETITLELIST# Special Function
Writes the string in the MOVIE LIST FOUND; the string can contain text and
variables.
Syntax:
#WRITETITLELIST#=[Text1][#?2#]
--->{Text#??#}
Parameters:
|
Text1, Text ... |
Optional.
The Text you want write. |
|
#??# |
Optional.
The Variable you want put in the string at the particular position. |
|
"
--->" |
Required.
This String is REQUIRED : Engine use this for separate the URL of a movie
from his TITLE! |
Examples:
1. #PUT#=Title=?0133093#06#
#PUT#=Matrix, The#07#
#WRITETITLELIST#=http://imdb.com/#06# ---> #07#
This Example write the URL and the TITLE of the "Matrix" Movie.
Remarks:
You MUST use this function for
create the list of all movies found on a page.
Script
Function Reference | Top
The
#TITLE# Special Function
Takes the TITLE of the movie.
Syntax:
#TITLE#=#??# #ONERROR#=*?*
Parameters:
|
#??# |
Required.
The Variable where is stored the TITLE of the movie. |
|
#ONERROR#=*options* |
Optional.
In the options you can specify what Engine must do in case of ERROR
of the Function :
STOP -> Will terminate the BLOCK where is the Function.
ASK -> Will show you the message of error and the
script-line where it is located
OK -> Will ignore the error and go on with
executing the others functions |
Examples:
1. #TITLE#=#03# #ONERROR#=*ASK*
This Example Takes the title of the movie that is stored on the #03# variable.
Script Function Reference | Top
The
#TAKEDIRECTOR# Special Function
Takes the Director of the movie.
Syntax:
#TAKEDIRECTOR#=#??#
Parameters:
|
#??# |
Required.
The Variable where the NAME of the Director is stored. |
Examples:
1. #TAKEDIRECTOR#=#03#
This Example Takes the Name of Director of the movie that is stored on the #03# variable.
Script Function Reference | Top
The
#TAKEACTOR# Special Function
Takes the Name of an Actor.
Syntax:
#TAKEACTOR#=#??#
Parameters:
|
#??# |
Required.
The Variable where the NAME of the Actor is stored. |
Examples:
1. #TAKEACTOR#=#03#
This Example Takes the Name of Actor that is stored on the #03# variable. You can use this function several time for take all actors.
Script Function Reference | Top
The
#TAKEGENRE# Special Function
Takes the Genre of a Movie.
Syntax:
#TAKEGENRE#=#??#
Parameters:
|
#??# |
Required.
The Variable where the GENRE of the Movie is stored. |
Examples:
1. #TAKEGENRE#=#03#
This Example Takes the Name of Actor that is stored on the #03# variable.
Script Function Reference | Top
The
#TAKERATING# Special Function
Takes the Rating of Movie.
Syntax:
#TAKERATING#=#??#
Parameters:
|
#??# |
Required.
The Variable where RATING of the Movie is stored. |
Examples:
1. #TAKERATING#=#03#
This Example Takes the Rating on the #03# variable.
Script Function Reference | Top
The
#TAKECOMMENTS# Special Function
Takes the Comments of Movie.
Syntax:
#TAKECOMMENTS#=#??#
Parameters:
|
#??# |
Required.
The Variable where the Comment of the Movie is stored. |
Examples:
1. #TAKECOMMENTS#=#03#
This Example Takes a comment on the #03# variable.You can use this several times for take all comment's line.
Script Function Reference | Top
The
#TAKEPLOT# Special Function
Takes the Plot of Movie.
Syntax:
#TAKEPLOT#=#??#
Parameters:
|
#??# |
Required.
The Variable where the Plot of the Movie is stored. |
Examples:
1. #TAKEPLOT#=#03#
This Example Takes a Plot on the #03# variable.You can use this several times for take all plot's line.
Script Function Reference | Top
The
#TAKERUNTIME# Special Function
Takes the Runtime of Movie.
Syntax:
#TAKERUNTIME#=#??#
Parameters:
|
#??# |
Required.
The Variable where Runtime of the Movie is stored. |
Examples:
1. #TAKERUNTIME#=#03#
This Example Takes the RUNTIME on the #03# variable.
Script Function Reference | Top
The
#TAKEYEAR# Special Function
Takes the Year of Movie.
Syntax:
#TAKEYEAR#=#??#
Parameters:
|
#??# |
Required.
The Variable where Year of the Movie is stored. |
Examples:
1. #TAKEYEAR#=#03#
This Example Takes the Year on the #03# variable.
Script Function Reference | Top
The
#TAKEPOSTER# (#TAKEPICTURE#) Special Function
Takes the Poster of Movie and stores it for you.
Syntax:
#TAKEPOSTER#=#??#
Parameters:
|
#??# |
Required.
The Variable where the URL of the Poster is stored. |
Examples:
1. #TAKEPOSTER#=#03#
This Example Takes the Poster at the URL stored on #03# variable.
Remarks:
You must write on the variable #??# the URL of the poster Image, Engine will
download and rename it for you.You can use this function several times for
download all images you want.
Script Function Reference | Top
The
#LOADCURSOR# Special Function
Loads a value in
the Cursor Variable.
Syntax:
#LOADCURSOR#=#??#
Parameters:
|
#??# |
Required.
The Variable where the value is stored. |
Examples:
1. #LOADCURSOR#=#03#
Script Function Reference | Top
The
#TAKEXXX# Special Function
Take the XXX
Variable.
Syntax:
#TAKEXXX#=#??#
Parameters:
|
#??# |
Required.
The Variable where the XXX of the Movie is stored. |
Examples:
1. #TAKEXXX#=#03#
This Example Takes the XXX on the #03# variable.
Script Function Reference | Top
The
#RESETCURSOR# Special Function
Reset the Cursor variable.
Syntax:
#RESETCURSOR#
Parameters:
Examples:
1. #RESETCURSOR#
Script Function Reference | Top
The
#GETTITLE# Special Function
Put the title of
the movie inn a variable, useful if you need the movie's title in the script.
Syntax:
#GETTITLE#=#??#
Parameters:
|
#??# |
Required.
The Variable where the title movie must be loaded. |
Examples:
1. #GETTITLE#=#03#
Script Function Reference | Top
The
#CLEARTAGS# Special Function
Clear all tags inside a variable.
Syntax:
#CLEARTAGS#=#??#
Parameters:
|
#??# |
Required.
The Variable that must be cleared |
Script Function Reference | Top
The
#TAKEFILE# Special Function
Download a file
from web and save it in the "Download" subfolder of XMM. Useful for Subtitles
for example.
Syntax:
#TAKEFILE#=#??#
Parameters:
|
#??# |
Required.
The Variable that contain the URL of the file |
Script Function Reference | Top