Home
  Features
  Download
  Plug-Ins
  Links

Documentation
  User Guide
  F.A.Q.

Developer
  Dsub script
  Plug-Ins SDK

Support
  Forum
  Contact

Other
  DVD Collection

Username:
Password:
Save Password

Forgot your Password?

Not a member?
The Administrator has turned off Registration for this forum.
Only registered members are able to log in





Dsubscript is a small script language that allow you to automatize some DVDSubber functions, it's also the language used by external program or plug-ins to communicate with DVDSubber.

Dsubscript will also be used in the upcoming new skin format

To test a dsubscript the best this to do is to use the console plug-ins which allow you either to type commands directly or load a script file.


If you create a file named Autoexec.dscmd inside DVDSubber main directory it will be automaticaly executed during startup.


Table of contents

 
Basic Syntax
Functions
Objects

Code example



Basic syntax

  dsubscript syntax is easy but you need to follow certain rules.
  • dsubscriot is case sensitive for example cmd.play is not the samething than CMD.PLAY or even Cmd.play.
  • For boolean operation :

    FALSE = 0
    TRUE = Different from 0
  • In dsubscript you have operators, comparators, objects and functions

    Operators like +,-,*,/,= allow you to do simple mathematics functions.

    Comparators like OR, AND, >=, <=, == allow to compare two values. (Use in if function)

    NOTE : It's important to differecientate == and =

    == - Return 0 if the two values are not equal, Return 1 if they are.
    = - Copy the value for the right side into the variable on the left side.
  • You can only put one command function per line, the only exception is with the operators.

    For example you can't do that:

    cmd.play() cmd.stop()


    But you can do that :

    result = playlist.count() + playlist.actitem.pos()
  • If you call a paramets less function you can omit the parenthesis but only if the function is alone on the line.

    You can do :

    playlist.actitem.pos

    But when there is more than one function per line you must add the parenthesis.

    result = playlist.actitem.pos() + 1
  • All variable must be declared before usage. Like in C you can create them anywhere. Right now there is only two type available : int for integer variable and str for strings

    To declare a variable write it's type then the variable name, for example :

    str TestString
    int TestInt


    Create a variable named TestString of type string and a variable TestInt of type integer.
  • Like variables functions must be declared before being used. You can declare them anywhere except inside another function.
    Inside the function code you can use the automaticaly created result variable to return a value.

    To declare a function first give it's type, then it's name, in parenthesis it's parameters and then it's code between { }:

    function Test(int A, int B)
    {
          cmd.play()
          result = 1
    }


    This code create a variable named Test who take two integer parameters. This function return 1



Functions

 
System functions

//

Comments. everything after those two symbols will be considered as being coments and won't be interpreted.

strtoint(str)

Convert a string into a integer. If str don't contain a valid value then return 0

inttostr(n)

Convert an integer into a string.

if ( .condition. )
{

      This part is executed if condition it TRUE
}
else
{

       This part is executed if condition it FALSE
}



Objects

  version
(default)
name
build
date
interface
show
hide
allowcontextmenu(n)
allowdirectcontrol(n)
video
showborder(n)
showcaption(n)
position(n,n)
size(n,n)
stayontop(n)
fullscreen(n)
isfullscreen
show
hide
isvisible
player
getstate
getmode
getactfile
timecode
duration
chapter
title
system
time
hour
min
sec
ms
date
day
month
year
memory
volume
(default)
up
down
setvalue(n)
mute(n)
ismuted
profile
load(str)
actvolume
actlanguage
select(n,n)
volumes.count
volumes(n)
name (default)
pos
createdby
languages.count
languages(n)
name (default)
pos
createdby
playlist
add(str)
count
clear
open(str)
save(str)
swap(n,n)
actitem
pos
filename (default)
play
shortfn
friendly
profile
title
duration
delete
actitem(n)
pos
filename (default)
play
shortfn
friendly
profile
title
duration
delete
random(n)
isfileinqueue(str)
repeat(n)
graph
creationlog
listfilters
filterbyname(str)
name
clsid
showproperties
pins
list
count

filterbystr(str)
name
clsid
showproperties
pins
list
count

filterbyclsid(str)
name
clsid
showproperties
pins
list
count
cmd
ir(str)
play
pause
quit
enterconfig
...


Code Examples

 

Example 1
video.position(0,0)
video.size(50,50)
video.showborder(0)
video.showcaption(0)
interface.hide
interface.allowdirectcontrol(0)
interface.allowcontextmenu(0)
cmd.enterfilemode
playlist.repeat(1)
cmd.play

This code do the following :
Move the video window to coordinates 0,0 (line 1)
Change the size of the video window to 50x50 pixels. (line 2)
Hide the video window border. (line 3)
Hide the video window caption bar. (line 4)
Disable the user interface buttons. (line 5)
Disable the main context menu. (line 6)
Switch to media file mode. (line 7)
Turn-on repeat mode, the playlist will playback in loop. (line 8 )
Start playback. (line 9)
Similar code can be user for example for demo computers, if you want the video to playback in loop automaticaly.



 

Example 2
function ampmdetector()
{
   if (system.time.hour < 12)
   {
      result = "AM"
   }
   else
   {
      result = "PM"
   }
}

print(version() + " " +ampmdetector())

This code do the following :
Display the current version followed by AM or PM depending if the current system time it before noon or after.