Help with script,please

Forum to discuss MLScript plugin that enables VBScript and JavaScript scripting within MLServer3.
User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Help with script,please

Postby hakha4 » Fri Feb 20, 2009 1:29 pm

Hi!
Trying to write a script to set pathway for launching VLC with different locations. Could someone please look at code below and give me a hint whats wong,no errors when test but don't work. I'm calling the script with :
(scripname = SetVLC)

MLServeCmd.MLScript|SetVLC~"HTPC1"

and want the result in variable Vlc_plugin_path


Option Explicit

Sub SetPath (Params)

dim tmp_activezone
dim tmp_string

tmp_activezone = Params(0)
'tmp_activezone = "HTPC1"

If tmp_activezone = "Server1" Then
tmp_string = "C:\vlc_plugin\vlc_vb.exe"
End If

If tmp_activezone = "HTPC1" Then
tmp_string = "\\HTPC1\C:\vlc_plugin\vlc_vb.exe"
End If

If tmp_activezone = "HTPC2" Then
tmp_string = "\\HTPC2\C:\vlc_plugin\vlc_vb.exe"
End If


MLServer.SetVariable "vlc_plugin_path",tmp_string

End Sub


Is the way of calling wrong? Wrong thinking in code?
Regards Håkan

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Fri Feb 20, 2009 8:12 pm

I'm not near my server, but in the wiki it says

MLServeCmd.MLScript|ScriptName for scripts that do not require parameters passed to them

or

MLServeCmd.MLScript|ScriptName~FunctionName~Parameter1~Parameter2~...ParameterN for scripts that require parameters passed to them


So if you want to pass params it looks like you need to call a function in the script.

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Fri Feb 20, 2009 8:15 pm

try

MLServeCmd.MLScript|SetVLC~SetPath~HTPC1

no quotes on the variables and call the sub.

User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Postby hakha4 » Sat Feb 21, 2009 3:04 am

Thanks a lot!
MLServeCmd.MLScript|SetVLC~SetPath~HTPC1 did the trick. Now I can go on doing stuff
Regards Håkan

User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Postby hakha4 » Sat Feb 21, 2009 6:36 am

Hi BigDvette!
Can I ask you or someone else another question?
I don't really fancy the TT-player so I'mworking on a solution for VLC and I'm almost there. I have integrated VLC in a small VB6 program so I really can do what I want with the player. (I've done quite a lot of vb-programming but not yet got the feeling for MLServer commands!)

In DvdLobby I'm launching the command :

Macro|MLServeCmd.MLScript|SetVLC~SetPath~{{clientname}}|SetVariable|media_{{clientname}}_transport_source~VLC!MLDVDLobby|MakeSource~{{media_{{clientname}}_transport_source}}!AV.AS{{media_{{clientname}}_activeplayer}}|MLPause|1!MLFileOpen|{{vlc_plugin_path}} ~<<file>>

Thr aim is to set the variable vlc_plugin_path depending on what client and launch the vlc_vb-program to play the file.. If I lanch the SetVLC script from command prompt it's changing variable as wanted. The problem in the DvdLobby command is that :

MLServeCmd.MLScript|SetVLC~SetPath~{{clientname}}|SetVariable|media_{{clientname}}_transport_source~VLC!MLDVDLobby

seems to be translated as one entity by server.
Is it wrong to launch a script from here?
Wrong delimiter beetwen statements?
Much appreciate if someone could give me a hint
Regards Håkan

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Sun Feb 22, 2009 12:22 pm

I think the problem is in your Macro command delimeter

Macro|MLServeCmd.MLScript|SetVLC~SetPath~{{clientname}}|SetVariable|media_{{clientname}}_transport_source~VLC!MLDVDLobby|MakeSource~{{media_{{clientname}}_transport_source}}!AV.AS{{media_{{clientname}}_activeplayer}}|MLPause|1!MLFileOpen|{{vlc_plugin_path}} ~<<file>>

should be

Macro|MLServeCmd.MLScript|SetVLC~SetPath~{{clientname}}!SetVariable|media_{{clientname}}_transport_source~VLC!MLDVDLobby|MakeSource~{{media_{{clientname}}_transport_source}}!AV.AS{{media_{{clientname}}_activeplayer}}!MLPause|1!MLFileOpen|{{vlc_plugin_path}} ~<<file>>

after the setpath~{{clientname}} you are using a | not a ! and again before MLPause

If that is not it, maybe you can write it out in english what you are trying to do. ie.

Call MLScript to set variable xxxx to yyyy
set variable mediaxxxx to VLC
.
.
.


Are you tring to send that setvariable to the script?

User avatar
hakha4
Member
Member
Posts: 88
Joined: Wed Dec 24, 2008 3:18 am
Location: Moholm Sweden
Contact:

Postby hakha4 » Mon Feb 23, 2009 1:38 am

Hi!
Thank's a lot again,it works now. I've been searching the WIKI to find out when to use the | and ! in commands but i haven't find it. What are the rules to build commands ?
Regards Håkan

bigDvette
Expert
Expert
Posts: 718
Joined: Thu Oct 12, 2006 12:19 pm
Contact:

Postby bigDvette » Mon Feb 23, 2009 10:25 am

Glad it worked.

As for rules, I'd just say every command has a syntax and sometimes an alternate syntax as well (like different delimiters so you can nest commands).

When issuing multiple commands, you use Macro and the delimiter between commands is a !.

Most commands start with the pluginname then a | then the function or device in the plugin and use ~ for the rest of the delims. However, best to just look up each command and know the syntax using the wiki.


Return to “MLScript”

Who is online

Users browsing this forum: No registered users and 1 guest