User Tools

Site Tools


programmer_s_guide

Programmer's Guide

(C) 2001-2014 BinaryWorks.it
Web : http://www.binaryworks.it
E-Mail : alessioviti@binaryworks.it
Documentation Version [4.6]

Disclaimer

The author is in no way responsible for any damage, loss or costs that the installation or use of this program (or attempted installation or use) may cause you or your equipment. Installation and use of this program is entirely at your own risk. This program comes with no guarantees and is provided on an 'as is' basis. The author makes no guarantees on its soundness, reliability or suitability for any given purpose.

TOP

What Is MagicScript

MagicScript Technology is the new way to import information about your favourite movies from the web. In its past version, eXtreme Movie Manager allowed you to import information from two important websites only: imdb.com & dvdempire.com. With this new version, you can, in theory, import information from all the websites you want!

TOP

How To Use MagicScript

MagicScript is a mini programming language that will allow you to write code to obtain information from a HTML page. For this purpose, you can use IF and REPEAT-WHILE statements, and many others. Of course, this language isn't as powerful as other complete languages like Basic etc., but it is sufficiently powerful for eXtreme Movie Manager's goals.

A Script won't be simple to build if you don't know any other programming languages. In this case you can use the Ready-Made Scripts available on my web page.

Script Structure

A Script is a normal TXT file composed of INSTRUCTIONS, BLOCKS and STATEMENTS that you can edit with any editor.

Every Script file is associated with one movie site, so there will be a Script file for IMDb, another one for dvdempire, etc…

The structure of the text is free. This means that you can add notes and comments where you want, because all keywords are written inside sharps, like this : #IF#

The basic structure that must be present in every Script is formed by the keyword #WEBQUERY# and the Block #RIGHTPAGEFOUND#. We will discuss their functions in detail later.

A Script consists of a series of BLOCKS. Functions & Instruction inside Blocks are executed sequentially until the end of every BLOCK is reached.

When you want to import information, MagicScript opens the Script of the Web site you want and proceeds to gathering information as described in the Script. Of course, a script written for IMDb will not work in the dvdempire.com site, and you will probably have an unpredictable end of program.

As I have said, the Keyword #WEBQUERY# must be contained in every script to question the DB of a movie website. The BLOCK #RIGHTPAGEFOUND# is vital too. It can check if you have found what you are looking for. All other blocks are optional. For example, if the information retrieved from IMDb is satisfactory to you, but you want all the BoxCover from dvdempire.com, you can write a Full Script for IMDb and a little script for dvdempire with only the BLOCK to take the images : #POSTER#…#ENDPOSTER# Of course there is another way to do it : you can simply check the Cover Option in eXtreme Movie Manager Import Config and you will take only that.

Why Block Structure?

For every item of information imported there is a special Block. This is because if a user wants to import only a particular item, he can uncheck all the others directly inside the software, without modify the script. For example, to take the TITLE of a movie, you should write all of the instructions inside this Block:

     #MOVIETITLE#
        ......
        ......
        #TITLE#=#03# #ONERROR#=*ASK*
    #ENDMOVIETITLE#

Of couse, you can also use only one Block ( #MOVIETITLE# in this case) to write ALL the instructions for gathering all information, but your script will be less configurable by users.

TOP

First, Second and Third Script Generation

From eXtreme Movie Manager 1.0 to 4.8, the engine can handle two different types of Scripts : the OLD, also known as First Generation, and the Latest, or Second Generation. The instructions and functions are the same for both ( 2. has some new ), but the difference is the HTML. When the engine detects a First Generation script, the HTML is “pre-processed”. This means that the HTML is rewritten in more lines, how it is if you edit with a normal text editor. The Second Generation doesn't pre-process the HTML (so the speed is increased), but the HTML in most cases is contained in only one line. This means that a Second Generation script cannot work with Divxmanager 0.9, because the HTML is always pre-processed.

Divxmanager 1.0 can work with both 1. and 2. because it can “read” the generation with this line : #SCRIPTGENERATION#=2

The 2. also has another Header variable : #REPLACESPACES# This tells the engine what characters must be used to replace spaces in the movie title when querying the Web sites. This is indispensable for sites like ALLOCINE.FR (or the movie will not be found).

From eXtreme Movie Manager 5.0, the engine can handle only Third Generation Scripts. The instructions and functions are the same as Second Generation, but there are several new ones to import TV series and to parse the HTML better. In the Third Generation, the HTML is “pre-processed” (like Generation 1), because it is easier and quicker to make scripts in this way.

The most uptodate Script Generation is 3 for eXtreme Movie Manager 8.x.

TOP

Constant & Variables
#WEBQUERY# Search adress (http://akas.imdb.com/find?s=all&q=#MOVIE#)
#WEBQUERYID# Web adress (http://akas.imdb.com/Details?#MOVIEUPDATEID#)
#MOVIE# Search Name of the Movie
#MOVIEUPDATEID# Last used movie link for import
#SCRIPTWEBSITE# Base web adress (http://akas.imdb.com/)

TOP

Script's Header
#DATEBUILD# Date of script's creation or last modification
#ICONQUALITY# Quality of the pics
#LANGUAGESORT# Language of the web site info
#MADEBY# Name of script's creator or modifier
#NOTE# Characteristic of script
#OPTIONS# 0 = No options or 1 = With options
#RELEASE# Minimum XMM release
#REPLACESPACES# Characters that must replace the spaces in the movie's title (for query the web)
#SCRIPTFORACTORS# TRUE|FALSE
#SCRIPTGENERATION# Generation of the script (actual = 3)
#SCRIPTQUALITY# Quality of the script
#TVSERIES# TRUE|FALSE
#TYPE# 0 = Complete or 1 = Only covers or 2 = Only information
#WEBSITE# URL of web site

TOP

Blocks

Important note:
There are some #TAKExx# coammands that don't have an own block like #TAKENOTES#. These have to be put in any other existing block.

Start of Block ⇒
End of Block
Function(s) Description
#ACTORDATA# ⇒
#ENDACTORDATA#
Contains all functions to get every data of an actor
#ADDFILMOGRAPHY# Get actor's movies
#TAKEACTORAWARDS# Get actor's awards
#TAKEACTORBDATE# Get actor's birthdate
#TAKEACTORBIO# Get actor's biography
#TAKEACTORBIRTHNAME# Get actor's birthname
#TAKEACTORBPLACE# Get actor's birth place
#TAKEACTORCOMMENTS# Get actor's comments
#TAKEACTORCOUNTRY# Get actor's birth country
#TAKEACTORCUSTOMx# Get actor's custom info
#TAKEACTORFILM# Get actor's movie in database
#TAKEACTORNAME# Get actor's real name
#TAKEACTORPROFESSION# Get actor's profession
#TAKEACTORSEX# Get actor's kitu CRM iere
#TAKEACTORWEB# Get actor's website
#TAKEACTORWEBID# Get actor's web id
#TAKEACTORWEBPAGE# Get actor's homepage
#ACTORS# ⇒
#ENDACTORS#
#TAKEACTOR# Get all actors of a movies
#AUDIODVD# ⇒
#ENDAUDIODVD#
#TAKEAUDIODVD# Get audio of the DVD
#AWARDS# ⇒
#ENDAWARDS#
#TAKEAWARDS# Get awards infos
#CHAPTERS# ⇒
#ENDCHAPTERS#
#TAKECHAPTERS# Get chapters of the DVD
#COMMENTS# ⇒
#ENDCOMMENTS#
#TAKECOMMENTS# Get comments
#COUNTRY# ⇒
#ENDCOUNTRY#
#TAKECOUNTRY# Get country
#CREATEEPISODELIST# ⇒
#ENDCREATEEPISODELIST#
#WRITETITLELIST# Create a list of all episodes of a tv show
#CREATEMOVIELIST# ⇒
#ENDCREATEMOVIELIST#
#WRITETITLELIST# Create a list of all movies that fit the search word
#CUSTOM1#…#CUSTOM11# ⇒
#ENDCUSTOM1#…#ENDCUSTOM11#
#TAKECUSTOM1# Get custom infos no. 1 to 11
Fixed names to:
C1 = IMDBTop250
C2 = ReleaseDate
C3 = Editor
C4 = Repository
C5 = Budget
C6 = Revenue
C7 = Awards (number)
C8 = IMDBLink
C9 = AKASTitle
C10 = Goofs
C11 = Trivia
#DELETETAGS# ⇒
#ENDDELETETAGS#
#DELETEWORD# Delete tags in here
#DIRECTOR# ⇒
#ENDDIRECTOR#
#TAKEDIRECTOR# Get the director
#DISTRIBUTOR# ⇒
#ENDDISTRIBUTOR#
#TAKEDISTRIBUTOR# Get the distributor
#EDITION# ⇒
#ENDEDITION#
#TAKEEDITION# Get edition info
#EPISODEAIRDATE# ⇒
#ENDEPISODEAIRDATE#
#TAKEPREMIERED# Get the episode's premiere date
#EPISODEDIRECTOR# ⇒
#ENDEPISODEDIRECTOR#
#TAKEDIRECTOR# Get the episode's director
#EPISODEPLOT# ⇒
#ENDEPISODEPLOT#
#TAKEPLOT# Get the episode's plot
#EPISODESHOWSTARS# ⇒
#ENDEPISODESHOWSTARS#
#TAKEACTORSERIE# Get episode's actors
#EPISODESTORY# ⇒
#ENDEPISODESTORY#
#TAKESTORY# Get the episode's story
#EPISODETITLE# ⇒
#ENDEPISODETITLE#
#TITLE# Get the episode's title
#EPISODEWRITER# ⇒
#ENDEPISODEWRITER#
#TAKEWRITER# Get the episode's writer
#FEATURES# ⇒
#ENDFEATURES#
#TAKEFEATURES# Get the features of a DVD
#GENRE# ⇒
#ENDGENRE#
#TAKEGENRE# Get the genre
#LANGUAGE# ⇒
#ENDLANGUAGE#
#TAKELANGUAGE# Get the original language of a DVD
#LOADOPTIONS# ⇒
#ENDLOADOPTIONS#
#SETOPTION# Load script's options
#LOADWEBSLOTS# ⇒
#ENDLOADWEBSLOTS#
#LOADWEBSLOT1# Load web slots (1 to 5)
#MEDIA# ⇒
#ENDMEDIA#
#TAKEMEDIA# Get the media type
#MEDIALANGUAGE# ⇒
#ENDMEDIALANGUAGE#
#TAKEMEDIALANGUAGE# Get the languages of a DVD
#MEDIAYEAR# ⇒
#ENDMEDIAYEAR#
#TAKEMEDIAYEAR# Get the publication year of a DVD
#MOVIEID# ⇒
#ENDMOVIEID#
#TAKEMOVIEID# Get the movie's web site id
#MOVIETITLE# ⇒
#ENDMOVIETITLE#
#GETTITLE# Get the movie's title
#MPAA# ⇒
#ENDMPAA#
#TAKEMPAA# Get the MPAA for a movie
#MUSIC# ⇒
#ENDMUSIC#
#TAKEMUSIC# Get the music info of a movie
#NUMBER# ⇒
#ENDNUMBER#
#TAKENUMBER# Get number of discs
NO BLOCK #TAKECHARACTERINFO# Get info about each character
NO BLOCK #TAKESERIESTATUS# Get status of the series
#OFFICIALWEB# ⇒
#ENDOFFICIALWEB#
#TAKEOFFICIALWEB# Get official web site of a movie
#ORIGINAL# ⇒
#ENDORIGINAL#
#TAKEORIGINALTITLE# Get the original title of a movie
#PACKAGING# ⇒
#ENDPACKAGING#
#TAKEPACKAGING# Get packaging info of a movie
#PHOTOGRAPHER# ⇒
#ENDPHOTOGRAPHER#
#TAKEPHOTOGRAPHER# Get the photographer
#PLOT# ⇒
#ENDPLOT#
#TAKEPLOT# Get the plot
#POSTER# ⇒
#ENDPOSTER#
#TAKEPOSTER# Get all posters of a movie
#PREMIERED# ⇒
#ENDPREMIERED#
#TAKEPREMIERED# Get the premiere date of a movie
#PRODUCER# ⇒
#ENDPRODUCER#
#TAKEPRODUCER# Get the producer
#RATING# ⇒
#ENDRATING#
#TAKERATING# Get the official rating
#REGION# ⇒
#ENDREGION#
#TAKEREGION# Get the regeion of a DVD
#REVIEWS# ⇒
#ENDREVIEWS#
#TAKEREVIEWS# Get the reviews of a movie
#RIGHTPAGEFOUND# ⇒
#ENDRIGHTPAGEFOUND#
#CONDITIONRIGHTPAGE# Block to analyze if the search returns directly the Movie Page or the List of Movies to show
#RUNTIME# ⇒
#ENDRUNTIME#
#TAKERUNTIME# Get the runtime of a movie
#SCREENDVD# ⇒
#ENDSCREENDVD#
#TAKESCREENDVD# Get the resolution of a DVD
#SERIEAWARDS# ⇒
#ENDSERIEAWARDS#
#TAKEAWARDS# Get the awards for a tv show
#SERIECOUNTRY# ⇒
#ENDSERIECOUNTRY#
#TAKECOUNTRY# Get the country of a tv show
#SERIEGENRE# ⇒
#ENDSERIEGENRE#
#TAKEGENRE# Get the genre of a tv show
#SERIELANGUAGE# ⇒
#ENDSERIELANGUAGE#
#TAKELANGUAGE# Get the language of a tv show
#SERIEPLOT# ⇒
#ENDSERIEPLOT#
#TAKEPLOT# Get the plot of a tv show
#SERIEPOSTER# ⇒
#ENDSERIEPOSTER#
#TAKEPOSTERSERIE# Get the poster of a tv show
#SERIEPREMIERED# ⇒
#ENDSERIEPREMIERED#
#TAKEPREMIERED# Get the premiere date of a tv show
#SERIESUBGENRE# ⇒
#ENDSERIESUBGENRE#
#TAKESUBGENRE# Get the subgenre of a tv show
#SERIETITLE# ⇒
#ENDSERIETITLE#
#ORIGINALTITLE# Get the title of a tv show
#SETVARIABLES# ⇒
#ENDSETVARIABLES#
#SETOPTION# Predefine script's variables
#SIMILARSHOWS# ⇒
#ENDSIMILARSHOWS#
#SIMILARSHOWS# Get similar shows
#STUDIO# ⇒
#ENDSTUDIO#
#TAKESTUDIO# Get the production studio of a movie
#SUBGENRE# ⇒
#ENDSUBGENRE#
#TAKESUBGENRE# Get the subgenre of a movie
#SUBSTITUTETAGS# ⇒
#ENDSUBSTITUTETAGS#
#SUBSTITUTEWORD# Substitute tags in here
#SUBSTITUTEWEBQUERY# ⇒
#ENDSUBSTITUTEWEBQUERY#
#SUBSTITUTEWEBQUERYWORD# Substitute tags in #MOVIE# in here
#SUBTITLES# ⇒
#ENDSUBTITLES#
#TAKESUBTITLES# Get the subtitles of a DVD
#TAGLINE# ⇒
#ENDTAGLINE#
#TAKETAGLINE# Get the tag line of a movie
#TRAILER# ⇒
#ENDTRAILER#
#TAKETRAILER1# Get the trailer(s) or adress(es) of them
#UPC# ⇒
#ENDUPC#
#TAKEUPC# Get the UPC code
#WRITER# ⇒
#ENDWRITER#
#TAKEWRITER# Get the writer of a movie
#YEAR# ⇒
#ENDYEAR#
#TAKEYEAR# Get the production year of a movie

TOP

Functions & Instructions

Here is the list of Functions available in MagicScript:

#ADDACTOR#
#ADDFILMOGRAPHY#
#CHECKACTOREXIST#
#CHECKVARIABLE#
#CLEARBUFFERACTORS#
#CLEARTAGS#
#COMPUTECURSOR#
#COMPUTELINE#
#COMPUTEVAR#
#CONDITIONRIGHTPAGE#
#DELETEWORD#
#DOWNLOADTRAILER1#...#DOWNLOADTRAILER2#
#ENDIF#
#FIND#
#FINDLINE#
#FINDLINEPREVIOUS#
#FINDLINEVAR#
#FINDPREVIOUS#
#FINDPREVIOUSVAR#
#FINDVAR#
#GETACTORVAR#
#GETMOVIEVAR#
#GETWEBSITELINE#
#GETTITLE#
#GOTO#
#IF#
#ISNUMERICAL#
#LOADCURSOR#
#LOADWEBSLOT1#
#OPENNEWWEB#
#OPENWEBSLOT1#...#OPENWEBSLOT5#
#ORIGINALTITLE#
#PUT#
#PUTCURSOR#
#READNEXTLINE#
#READPREVIOUSLINE#
#REPEAT#
#RESETCURSOR#
#RESTOREMAIN#
#RESTOREWEB#
#RESTOREWEBSITELINE#
#SAVEEPISODEINFO#
#SAVEMOVIE#
#SAVEWEBSITELINE#
#SEARCHREPLACEVAR#
#SETCURSOR#
#SETOPTION#
#SHOWVAR#
#SIMILARSHOWS#
#STARTDELETETAGS#
#STARTREADWEB#
#STARTSUBSTITUTETAGS#
#STRING#
#SUBSTITUTEWEBQUERYWORD#
#SUBSTITUTEWORD#
#TAKEACTOR#
#TAKEACTORAWARDS#
#TAKEACTORBDATE#
#TAKEACTORBIO#
#TAKEACTORBIRTHNAME#
#TAKEACTORBPLACE#
#TAKEACTORCOMMENTS#
#TAKEACTORCOUNTRY#
#TAKEACTORCUSTOM1...TAKEACTORCUSTOM2#
#TAKEACTORFILM#
#TAKEACTORNAME#
#TAKEACTORPROFESSION#
#TAKEACTORSERIE#
#TAKEACTORSEX#
#TAKEACTORWEB#
#TAKEACTORWEBID#
#TAKEACTORWEBPAGE#
#TAKEAUDIODVD#
#TAKEAWARDS#
#TAKECHARACTERINFO#
#TAKECHAPTERS#
#TAKECOMMENTS#
#TAKECOUNTRY#
#TAKECUSTOM1#...#TAKECUSTOM11#
#TAKEDEATHDATE#
#TAKEDIRECTLINK#
#TAKEDIRECTOR#
#TAKEDISTRIBUTOR#
#TAKEDVDYEAR#
#TAKEEDITION#
#TAKEFEATURE#
#TAKEGENRE#
#TAKELANGUAGE#
#TAKEMEDIA#
#TAKEMEDIALANGUAGE#
#TAKEMEDIAYEAR#
#TAKEMOVIEID#
#TAKEMPAA#
#TAKEMUSIC#
#TAKENOTES#
#TAKENUMBER#
#TAKEOFFICIALWEB#
#TAKEORIGINAL#
#TAKEPACKAGING#
#TAKEPHOTOGRAPHER#
#TAKEPICTURE#
#TAKEPICTUREINMOVIES#
#TAKEPLOT#
#TAKEPOSTER#
#TAKEPOSTERBACK#
#TAKEPOSTEREPISODE#
#TAKEPOSTERFANART#
#TAKEPOSTERSERIE#
#TAKEPREMIERED#
#TAKEPRODCODE#
#TAKEPRODUCER#
#TAKEQUOTES#
#TAKERATING#
#TAKEREGION#
#TAKEREVIEW#
#TAKERUNTIME#
#TAKESCREENDVD#
#TAKESEASON#
#TAKESERIESTATUS#
#TAKESTORY#
#TAKESTUDIO#
#TAKESUBGENRE#
#TAKESUBTITLE#
#TAKETAGLINE#
#TAKETRAILER1#...#TAKETRAILER2#
#TAKEUPC#
#TAKEWORD#
#TAKEWORDLEN#
#TAKEWRITER#
#TAKEYEAR#
#TITLE#
#TRIM#
#WHILE#
#WRITETITLELIST#
#WRITEWARNING#

TOP

All Functions
ADDACTOR

#ADDACTOR#
Adds the Name of an Actor to Database.
Syntax:
#ADDACTOR#=#??#
Parameters:
#??# Required. The Variable where the NAME of the Actor is stored.
Examples:
1. #ADDACTOR#=#03#
This example takes the Name of Actor that is stored on the #03# variable. You can use this function several time to add all actors to Database.

TOP……Functions & Instructions

ADDFILMOGRAPHY

#ADDFILMOGRAPHY#
Adds a Movie to Actor's data.
Syntax:
#ADDFILMOGRAPHY#=#??#
Parameters:
#??# Required. The Variable where the INFO of the Movie is stored.
Examples:
1. #ADDFILMOGRAPHY#=#03#
This example takes the Info of a Movie that is stored on the #03# variable. You can use this function several time to add all movies.
Remarks:
The Info must have following structure: TITLE (YEAR)§Link to Movie§Script name
Example: Avatar (2009)§http://www.imdb.com/title/tt0499549/§IMDB.COM (Complete).txt

TOP……Functions & Instructions

CHECKACTOREXIST

#CHECKACTOREXIST#
Checks if the Name of an Actor is already in Database.
Syntax:
#CHECKACTOREXIST#=#?1#,#?2#
Parameters:
#?1# Required. The Variable where the RESULT is stored. 0 or Actor's ID in database.
#?2# Required. The Variable where the NAME of the Actor is stored.
Examples:
1. #CHECKACTOREXIST#=#03#,#04#
This example takes the Name of Actor that is stored on the #04# variable and returns the result on the #03# variable.

TOP……Functions & Instructions

CHECKVARIABLE

#CHECKVARIABLE#
Prepares a VARIABLE for #DELETETAGS#, #CLEARTAGS# or #SUBSTITUTETAGS#.
Syntax:
#CHECKVARIABLE#=#??#
Parameters:
#??# Required. The Variable that should be used.
Examples:
1. #CHECKVARIABLE#=#03#
This example takes the #03# variable and prepares it for #DELETETAGS#, #CLEARTAGS# or #SUBSTITUTETAGS#.

TOP……Functions & Instructions

CLEARBUFFERACTORS

#CLEARBUFFERACTORS#
Clears all data of a previously import of an Actor.
Syntax:
#CLEARBUFFERACTORS#
Parameters:
none

TOP……Functions & Instructions

CLEARTAGS

#CLEARTAGS#
Clears all tags inside a variable.
Syntax:
#CLEARTAGS#=#??#
Parameters:
#??# Required. The Variable that must be cleared.

TOP……Functions & Instructions

COMPUTECURSOR

#COMPUTECURSOR#
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”.

TOP……Functions & Instructions

COMPUTELINE

#COMPUTELINE#
Makes a SUM or SUBTRACTION to the actual.line position of the HTML code.
Syntax:
#COMPUTELINE#=±number
Parameters:
± Required. Is the operation you want to make.
number Required. Is the Value to SUM or SUBTRACT
Examples:
1. #COMPUTELINE#=+2
This Example adds 2 to the actual line of the HTML code.

TOP……Functions & Instructions

COMPUTEVAR

#COMPUTEVAR#
Makes a SUM or SUBTRACTION to a variable that contains a numerical variable.
Syntax:
#COMPUTEVAR#=#??#±number
Parameters:
#??# Required. The numerical Variable that should be used for operation.
± Required. Is the operation you want to make.
number Required. Is the Value to SUM or SUBTRACT
Examples:
1. #COMPUTEVAR#=#10#+2
This Example adds 2 to the variable #10#.

TOP……Functions & Instructions

CONDITIONRIGHTPAGE

#CONDITIONRIGHTPAGE#
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.

TOP……Functions & Instructions

DELETEWORD

#DELETEWORD#
Delete defined words inside a variable.
Syntax:
#DELETEWORD#=text
Parameters:
text Required. Any String that has to be deleted from a Variable.
Remarks:
Variable has to be prepared with #CHECKVARIABLE#. Function must be inside #DELETETAGS# block.

TOP……Functions & Instructions

DOWNLOADTRAILER1

#DOWNLOADTRAILER1#
Downloads the Link of a Trailer or the Link to the web page containing the
Trailer.
Syntax:
#DOWNLOADTRAILER1#=#?1##?2#
Parameters:
#?1# Required. Link of the Trailer.
#?2# Optional. Extension of the Trailer.
Examples:
1. #DOWNLOADTRAILER1#=#03#
This example stores the Link to the page of the Trailer in #03# variable.
2. #DOWNLOADTRAILER1#=#03##04#
This example stores the Link to the Trailer in #03# variable and the file extension in #04# variable.

TOP……Functions & Instructions

IF

#IF# ... #ENDIF#
The Engine can supports the IF Statement, but you can't make an IF statement inside another IF. It Means that you can use any IF you want but each one must be used separatly; however, you can put an IF Statement inside a REPEAT…WHILE and vice-versa. This release of MagicScript doesn't support the "ELSE" statement, but you have the #GOTO# Function that will help you in many different cases. The Structure is:
#IF# #?1# == #?2#
…..
…..
#ENDIF#
The IF compares two VARIABLES, and supports only these variables. If the result of the comparison is positive, Engine will execute the instruction inside IF-ENDIF, else all instructions will be ignored.This means that if you want to compare two strings, you must put it on empty VARIABLES first and then use the IF Statement. This isn't a big limitation for this kind of application.
Operators
Operators you can use with IF Statement:</nowiki>
"==" that means "Equal To", you can use it for strings and number comparisons
"<>" that means "Different", you can use it for strings and number comparisons
"<<" that means "Minor" , this makes a comparison only between numbers
">>" that means "Major" , this makes a comparison only between numbers
It isn't supported any operator like <= or => because these operators are useless.

TOP……Functions & Instructions

FIND

#FIND#
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.

TOP……Functions & Instructions

FINDLINE

#FINDLINE#
Search downwards for a string in a 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!.

TOP……Functions & Instructions

FINDLINEPREVIOUS

#FINDLINEPREVIOUS#
Search upwards for a string in a HTML page.
Syntax:
#FINDLINEPREVIOUS#=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. #FINDLINEPREVIOUS#=<title>#12##ONERROR#=*STOP*
2. #FINDLINEPREVIOUS#=<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
#FINDPREVIOUS#
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!.

TOP……Functions & Instructions

FINDLINEVAR

#FINDLINEVAR#
Search downwards for a variable in a HTML page.
Syntax:
#FINDLINEVAR#=#?1#?2##ONERROR#=*options*
Parameters:
#?1# Required. The variable containing the text to find in the HTML.
#?2# 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. #FINDLINEVAR#=#11##12##ONERROR#=*STOP*
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!.

TOP……Functions & Instructions

FINDPREVIOUS

#FINDPREVIOUS#
Search for a string backwards only in the CURRENT LINE of HTML page.
Syntax:
#FINDPREVIOUS#=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. #FINDPREVIOUS#=<title>#12##ONERROR#=*ASK*
2. #FINDPREVIOUS#=<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.

TOP……Functions & Instructions

FINDPREVIOUSVAR

#FINDPREVIOUSVAR#
Search backwards for a variable only in the CURRENT LINE of HTML page.
Syntax:
#FINDPREVIOUSVAR#=#?1##?2##ONERROR#=*options*
Parameters:
#?1# Required. The variable containing the text to find in the HTML.
#?2# 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. #FINDPREVIOUSVAR#=#11##12##ONERROR#=*ASK*
This Instruction is similar to the #FINDPREVIOUS#, 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.

TOP……Functions & Instructions

FINDVAR

#FINDVAR#
Search for a variable only in the CURRENT LINE of HTML page.
Syntax:
#FIND#=#?1##?2##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*
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.

TOP……Functions & Instructions

GETACTORVAR

#GETACTORVAR#
Take the Actor variables directly from database.
Syntax: #GETACTORVAR#=#??#=%WEBID%
Parameters:
#??# Required. The Variable where put the data taken from the Database.
%WEBID% Required. Example, this is for take the WebID of the actor .
Examples:
1. #GETACTORVAR#=#12#=%WEBID%
This Instruction is used to know if an Actor is alread on the Database, especially for IMDB).

TOP……Functions & Instructions

GETMOVIEVAR

#GETMOVIEVAR#
Put Movie Name in a variable.
Syntax: #GETMOVIEVAR#=#??#=%MOVIE%
Parameters:
#??# Required. The Variable where the title movie must be loaded.
%MOVIE% Required. The Title passed from XMM.
Examples:
1. #GETMOVIEVAR#=#12#=%MOVIE%

TOP……Functions & Instructions

GETTITLE

#GETTITLE#
Put the title of the movie in 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#

TOP……Functions & Instructions

GETWEBSITELINE

#GETWEBSITELINE#
Function to know the Current Text Line number of the Website HTML
Syntax:
#GETWEBSITELINE#=#??#
Parameters:
#??# Required. The Variable where the number must be loaded.
Examples:
1. #GETWEBSITELINE#=#03#

TOP……Functions & Instructions

GOTO

#GOTO#
Helping you to write powerful scripts, the #GOTO# Instruction is at your disposal. When the Engine will find this, the execution will jump to the LABEL specified.
The Structure of this Instruction is :
#GOTO#=LABEL
Where label is a LABEL in another line of the Script.
A LABEL statement is composed by a colon followed by text: ”:LABEL1”
When you want to go to this label, you must use this instruction:
"#GOTO#=LABEL1"
It is important not to put the colons in the #GOTO# instruction! :
"#GOTO#=:LABEL1" and to cancel all spaces to the right! If you write a goto like this: "#GOTO#=LABEL1 ", the Engine will not find the Label and will report to you an error!
Particular attention must be payed when you use #GOTO# inside REPEAT..WHILE Statement:
Example
Good Code:
In this part of code everything is OK, the #GOTO# Instruction points to a LABEL that is out of any IF and REPEAT.

  #REPEAT#
  #FIND#=Href="#10# #ONERROR#=*OK*
  #IF# #10# == #09#
  #GOTO#=CAST2
  #ENDIF#
  #FIND#=>#01# #ONERROR#=*ASK*
  #FIND#=<#02# #ONERROR#=*ASK*
  #TAKEWORD#=#03#,#01#,#02#
  #TAKEACTOR#=#03#
  #WHILE# #09#<>#10#
  :CAST2 

BAD Code :
This code is BADLY written, because the #GOTO# Instruction points to a LABEL inside another REPEAT! At this time of development, MagicScript will not warn you this error, and the result of this script ARE UNPREDICTABLE!

  #REPEAT#
  #FIND#=Href="#10# #ONERROR#=*OK*
  #IF# #10# == #09#
  #GOTO#=CAST2
  #ENDIF#
  #TAKEWORD#=#03#,#01#,#02#
  #TAKEACTOR#=#03#
  #WHILE# #09#<>#10#
  #REPEAT#
  #FIND#=Href="#10# #ONERROR#=*OK*
  :CAST2 
  #TAKEWORD#=#03#,#01#,#02#
  #TAKEACTOR#=#03#
  #WHILE# #09#<>#10#

TOP……Functions & Instructions

ISNUMERICAL

#ISNUMERICAL#
Checks if a variable is numerical.
Syntax:
#ISNUMERICAL#=#?1#,#?2#
Parameters:
#?1# Required. The Variable to be checked.
#?2# Required. The Result of the check. 1=numeric, 0=alphanumeric
Examples:
1. #ISNUMERICAL#=#01#,#02#

TOP……Functions & Instructions

LOADCURSOR

#LOADCURSOR#
Loads a value in the Cursor Variable.
Syntax:
#LOADCURSOR#=#??#
Parameters:
#??# Required. The Variable where the value is stored.
Examples:
1. #LOADCURSOR#=#03#

TOP……Functions & Instructions

LOADWEBSLOT1

#LOADWEBSLOT1#
Sets a previously loaded web page as active.
Syntax:
#LOADWEBSLOT1#
Parameters:
none
Examples:
1. #LOADWEBSLOT1#
Remarks:
Five Webslots are available: #LOADWEBSLOT1# to #LOADWEBSLOT5#

TOP……Functions & Instructions

OPENNEWWEB

#OPENNEWWEB#
Particular attention must be focused on this Special Function #OPENNEWWEB#.
Basically MagicScript Works with the HTML specified on #WEBQUERY# when you find directly the page of a movie, or another HTML you select from the LIST of MOVIE FOUND. With this instruction, you can OPEN and work to another HTML Until #RESTOREWEB# instruction is reached. This is particularly useful when some information (like plot in imdb.com, box covers in dvdempire.com) is stored in a different page. It is important that you SAVE the position of the CURSOR before using this function, so that you will find it when you go back to the original HTML.
Example:

  #OPENNEWWEB#=#50#
  #REPEAT#
  #FINDLINE#=http://posters.imdb.com#12##ONERROR#=*STOP*
  #FIND#=http://posters.imdb.com#01# #ONERROR#=*STOP*
  #IF# #12#<>#09#
  #FIND#="#02# #ONERROR#=*STOP*
  #TAKEWORD#=#03#,#01#,#02#
  #STRING#=#04#=h#03#
  #TAKEPOSTER#=#04#
  #ENDIF#
  #WHILE# #09#<>#12#
  #RESTOREWEB#

This is a part of imdb's Script. In the variable #50# is stored the URL of the page that contains the posters.
The Engine with #OPENNEWWEB# re-initializes itself. To start reading the new <nowiki>HTML, set the first line at the top (without #STARTREADWEB# function) and set <nowiki>CURSOR to 1. The functions inside #OPENNEWWEB# are executed sequentially until <nowiki>#RESTOREWEB# is reached.
NOTE: You can use this function where you want in the script and as many times as you want, BUT you can't use it inside another #OPENNEWWEB#-#RESTOREWB#.
You can have:
#OPENNEWWEB#=#50#
…..
#RESTOREWEB#
….
#OPENNEWWEB#=#50#
…..
#RESTOREWEB#
But it is not correct to write:
#OPENNEWWEB#=#50#
……
#OPENNEWWEB#=#50#
……
#RESTOREWEB#
……
#RESTOREWEB#
The result of this Script are UNPREDICTABLE

TOP……Functions & Instructions

OPENWEBSLOT1

#OPENWEBSLOT1#
Loads a web page into a slot.
Syntax:
#OPENWEBSLOT1#=#??#
Parameters:
#??# Required. The Variable containing the address of the web page.
Examples:
1. #OPENWEBSLOT1#=#03#
Remarks:
Five Webslots are available: #OPENWEBSLOT1# to #OPENWEBSLOT5#

TOP……Functions & Instructions

ORIGINALTITLE

#ORIGINALTITLE#
Takes the Original Title.
Syntax:
#ORIGINALTITLE#=#??#
Parameters:
#??# Required. The Variable where to store the Original Title.
Examples:
1. #ORIGINALTITLE#=#03#

TOP……Functions & Instructions

PUT

#PUT#
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# !.

TOP……Functions & Instructions

PUTCURSOR

#PUTCURSOR#
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 the CURSOR into #01# variable.

TOP……Functions & Instructions

READNEXTLINE

#READNEXTLINE#
Read the next line of HTML and set the CURSOR Variable to 1;
Syntax:
#READNEXTLINE#
#READNEXTLINE#=1
Parameters:
=1 Optional
Examples:
1. #READNEXTLINE#
Reads the next line of the HTML source.
2. #READNEXTLINE#=1
Reads the next non-empty line of the HTML source. The optional parameter =1 skips all empty lines and lines that have only (white) spaces.
Remarks:
This instruction is useful when you have found a particular thing with #FINDLINE# instruction and you want analyze the text line by line.

TOP……Functions & Instructions

READPREVIOUSLINE

#READPREVIOUSLINE#
Read the previous line of HTML and set the CURSOR Variable to 1;
Syntax:
#READPREVIOUSLINE#
#READPREVIOUSLINE#=1
Parameters:
=1 Optional
Examples:
1. #READPREVIOUSLINE#
Reads the previous line of the HTML source.
2. #READPREVIOUSLINE#=1
Reads the previous non-empty line of the HTML source. The optional parameter =1 skips all empty lines and lines that have only (white) spaces.
Remarks:
This instruction is useful when you have found a particular thing with #FINDLINE# instruction and you want analyze the text line by line.

TOP……Functions & Instructions

REPEAT

#REPEAT#...#WHILE#
The Engine can support REPEAT…WHILE Statement, but you can't make a REPEAT statement inside another REPEAT. It Means that you can use any REPEAT you want but each one must be used separatly. Inside a REPEAT, you can put all the instructions you want, also IF Statements (and vice-versa).
The Structure is:
#REPEAT#
…..
…..
#WHILE# #??# == #??#
The WHILE compares two VARIABLES, and supports only these variables. If the result of the comparison is positive, Engine will execute the cycle of instructions again, otherwise it will terminate the REPEAT-WHILE Statement. If you want to compare two strings, you must first put them on empty VARIABLES and then use the WHILE. This isn't a big limitation for this kind of application.
Operators:
Operators you can use with the WHILE Statement are:
” == ” that means “Equal To”, you can use it for strings and number comparison
”<>” that means “Different”, you can use it for strings and number comparison
You must be careful when you use a #GOTO# Instruction! See Example :
Good Code :
In this part of code everything is OK, the #GOTO# Instruction points to a LABEL that is out of any IF and REPEAT.
<code>

#REPEAT#
#FIND#=Href="#10# #ONERROR#=*OK*
#IF# #10# == #09#
#GOTO#=CAST2
#ENDIF#
#FIND#=>#01# #ONERROR#=*ASK*
#FIND#=<#02# #ONERROR#=*ASK*
#TAKEWORD#=#03#,#01#,#02#
#TAKEACTOR#=#03#
#WHILE# #09#<>#10#
:CAST2 

<code> BAD Code:
This code is BADLY written, because the #GOTO# Instruction points to a LABEL that is inside another REPEAT! At this time of development, MagicScript will not warn you of this error, and the result of this script ARE UNPREDICTABLE!
<code>

#REPEAT#
#FIND#=Href="#10# #ONERROR#=*OK*
#IF# #10# == #09#
#GOTO#=CAST2
#ENDIF#
#TAKEWORD#=#03#,#01#,#02#
#TAKEACTOR#=#03#
#WHILE# #09#<>#10#
#REPEAT#
#FIND#=Href="#10# #ONERROR#=*OK*
:CAST2 
#TAKEWORD#=#03#,#01#,#02#
#TAKEACTOR#=#03#
#WHILE# #09#<>#10#

<code>

TOP……Functions & Instructions

RESETCURSOR

#RESETCURSOR#
Reset the Cursor variable.
Syntax:
#RESETCURSOR#
Parameters:
none
Examples:
1. #RESETCURSOR#

TOP……Functions & Instructions

RESTOREWEBSITELINE

#RESTOREWEBSITELINE#
Restore the previously saved website line.
Syntax:
#RESTOREWEBSITELINE#
Parameters:
none
Examples:
1. #RESTOREWEBSITELINE#

TOP……Functions & Instructions

RESTOREMAIN

#RESTOREMAIN#
Function to Re-Open in memory the Main HTML. Used when you load other webpages with #LOADWEBSLOT?#
Syntax:
#RESTOREMAIN#
Parameters:
none
Examples:
1. #RESTOREMAIN#

TOP……Functions & Instructions

SAVEEPISODEINFO

#SAVEEPISODEINFO#
This instruction save the Current Episode Information and clear the variables for Next Episode
Syntax:
#SAVEEPISODEINFO#
Parameters:
none
Examples:
1. #SAVEEPISODEINFO#

TOP……Functions & Instructions

SAVEMOVIE

#SAVEMOVIE#
Force the Engine to Save Current Imported info in the Database without wait the End of Import Process
Syntax:
#SAVEMOVIE#
Parameters:
none
Examples:
1. #SAVEMOVIE#

TOP……Functions & Instructions

SAVEWEBSITELINE

#SAVEWEBSITELINE#
Save the actual website line.
Syntax:
#SAVEWEBSITELINE#
Parameters:
none
Examples:
1. #SAVEWEBSITELINE#

TOP……Functions & Instructions

SEARCHREPLACEVAR

#SEARCHREPLACEVAR#
Replaces a phrase inside a variable.
Syntax:
#SEARCHREPLACEVAR#=text1|text2#?1##?2#
Parameters:
text1 Required. The text that shall be replaced.

text2 Optional. The text used to replace text1. It's RegEx!
#?1# Required. The variable that contains the data that shall be checked. It will be modified!
#?2# Required. Has to be 0 or 1 for case sensitivity.
Examples:
1. #PUT#=1#11#
#SEARCHREPLACEVAR#=text1|text2#10##11#
This example modifies the phrase "text1" in variable #10# by "text2". #11# indicates yes for case sensitivity. Copy the original variable if the content is still needed by using <a href="#STRING">#STRING#</a>

TOP……Functions & Instructions

SETCURSOR

#SETCURSOR#
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.

TOP……Functions & Instructions

SETOPTION

#SETOPTION#
Set an option.
Syntax:
#SETOPTION#=#?1#?[text]text
Parameters:
#?1# Required. The Option Variable.
? Required. The Option's value.
[text] Required. The Name of the Option.
text Required. The Description of the Option
Examples:
1. #SETOPTION#=#80#1[Title Import]0=Do not Take The Title|1=Take the Title

TOP……Functions & Instructions

SHOWVAR

#SHOWVAR#
Show a variable, used for Debug
Syntax:
#SHOWVAR#=#??#
Parameters:
#??# The Variable to Show
Examples:
1. #SHOWVAR#=#??#

TOP……Functions & Instructions

SIMILARSHOWS

#SIMILARSHOWS#
Function to Import Similar TVShow
Syntax:
#SIMILARSHOWS#=#??#
Parameters:
#??# Required. The Varible of the Similar Show
Examples:
1. #SIMILARSHOWS#=#??#

TOP……Functions & Instructions

STARTDELETETAGS

#STARTDELETETAGS#
Call DELETETAGS block for a selected (#CHECKVARIABLE#) variable and delete text
parts.
Syntax:
#STARTDELETETAGS#
Parameters:
none
Examples:
1. #STARTDELETAGS#

TOP……Functions & Instructions

STARTREADWEB

#STARTREADWEB#
Reset the Read Engine to the first line of HTML and set the CURSOR Variable to 1.
Syntax:
#STARTREADWEB#
Parameters:
No Parameter
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.

TOP……Functions & Instructions

STARTSUBSTITUTETAGS

#STARTSUBSTITUTETAGS#
Call SUBSTITUTETAGS block for a selected (#CHECKVARIABLE#) variable and replace text parts.
Syntax:
#STARTSUBSTITUTETAGS#
Parameters:
none
Examples:
1. #STARTSUBSTITUTETAGS#

TOP……Functions & Instructions

STRING

#STRING#
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.

TOP……Functions & Instructions

SUBSTITUTEWEBQUERYWORD

#SUBSTITUTEWEBQUERYWORD#
Replace defined words inside variable #MOVIE#.
Syntax:
#SUBSTITUTEWEBQUERYWORD#=text1=text2
Parameters:
text1 Required. Any String that has to be replaced in variable #MOVIE#.
text2 Required. Any String that replaces a text in variable #MOVIE#.
Remarks:
Function must be inside #SUBSTITUTEWEBQUERY# block.

TOP……Functions & Instructions

SUBSTITUTEWORD

#SUBSTITUTEWORD#
Replace defined words inside a variable.
Syntax:
#SUBSTITUTEWORD#=text1=text2
Parameters:
text1 Required. Any String that has to be replaced in a Variable.
text2 Required. Any String that replaces a text in a Variable.
Remarks:
Variable has to be prepared with #CHECKVARIABLE#. Function must be inside #DELETETAGS# block.

TOP……Functions & Instructions

TAKEXXX

#TAKEXXX#
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.

TOP……Functions & Instructions

TAKEWORD

#TAKEWORD#
Takes a string from the current line.
Syntax:
#TAKEWORD#=#?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.

TOP……Functions & Instructions

TAKEWORDLEN

#TAKEWORDLEN#
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. #TAKEWORDLEN#=#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.

TOP……Functions & Instructions

TITLE

#TITLE#
Take the Title Variable.
Syntax:
#TITLE#=#??#
Parameters:
#??# Required. The Variable where the Title of the Movie is stored.
Examples:
1. #TITLE#=#03#
This Example Takes the Title on the #03# variable.

TOP……Functions & Instructions

TRIM

#TRIM#
Delete all leading and trailing spaces out of a selected (#CHECKVARIABLE#) variable.
Syntax:
#TRIM#
Parameters:
none
Examples:
1. #TRIM#

TOP……Functions & Instructions

WRITETITLELIST

#WRITETITLELIST#
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.

TOP……Functions & Instructions

WRITEWARNING

#WRITEWARNING#
Show a Messagebox with a text.
Syntax:
#WRITEWARNING#=Text
Parameters:
Text Required. The Text you want to write.
Examples:
1. #WRITEWARNING#=This may take some time to finish!

TOP……Functions & Instructions

Examples

TOP

Programmers Tips

TOP

MagicScript Editor

TOP

Known Bugs

TOP

Credits

TOP

programmer_s_guide.txt · Last modified: 2013/12/13 07:46 by jdommi