vbscript syntax

Forum to discuss MLScript plugin that enables VBScript and JavaScript scripting within MLServer3.
worf83
Senior Member
Senior Member
Posts: 131
Joined: Mon Feb 14, 2005 11:40 am
Contact:

vbscript syntax

Postby worf83 » Wed Aug 27, 2008 9:02 pm

Hello,

I realize we are not supposed to post script questions, only MLScript specific questions but... I am trying the below with no luck:

option explicit
dim wShell
Set wShell = CreateObject ("WScript.Shell")
wShell.Run """C:\Program files\MLServer\MLServer.exe "setVariable|test~88888""", 1, false
Set WShell = Nothing

Any help would be much appreciated.

TIA

AL

User avatar
DavidL
Simply Incredible
Simply Incredible
Posts: 11071
Joined: Sat Feb 08, 2003 9:39 am
Location: Metamora, Michigan
Contact:

Postby DavidL » Wed Aug 27, 2008 9:14 pm

Al, there is no issue with you posting script questions at all.
Just that it cannot be assumed that Cinemar can support all scripting questions. With that said, I have strong suspician that your question will be a answered by someone script literate.

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Wed Aug 27, 2008 9:35 pm

Are you just trying to set a variable? I believe the simplest way is:

MLServer.SetVariable "test", 88888

If you've declared a variable, no quotes required. If its text, like the name of the variable, put it in quotes. I run a script to calculate the amount of daylight each day and when I set my variable in MLServer I use:

MLServer.SetVariable "Daylight", daylight_hours & "Hours" & daylight_minutes & "Minutes"

This gives me a MLServer variable called Daylight with a value of 11 Hours 29 Minutes

daylight_hours and daylight_minutes were declared variables calculated in the script. Hours and Minutes are just text I added to the variable so they are in quotes.

Hope this helps. My apologies if I've misunderstood what you are trying to do.

Rick

worf83
Senior Member
Senior Member
Posts: 131
Joined: Mon Feb 14, 2005 11:40 am
Contact:

Postby worf83 » Wed Aug 27, 2008 9:42 pm

ricks,

Thanks for the reply. what i posted above is exactly what is in the .vbs.

can you post your script demonstrating the above? I can compare to what i have and adjust as needed.

TIA,

AL

ricks
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1127
Joined: Wed Oct 27, 2004 7:01 pm
Location: Latham, Massachusetts
Contact:

Postby ricks » Wed Aug 27, 2008 10:26 pm

Hi Al,

Unfortunately MLScripts doesn't let me copy/paste (no idea why) so I'll have to fat-finger some code. Lets just use numbers to create an MLServer variable.

In simplest terms its:
- declare variables
- get variables from MLS
- do something to variables
- return variables to MLS

Option Explicit

' Declare variables
dim first_number, second_number, final_number

' Get Variables from MLServer where mlvariable_1 = 7 and mlvariable_2 = 5
first_number = MLServer.GetVariable ("mlvariable_1")
second_number = MLServer.GetVariable ("mlvariable_2")

' Then set the variable in MLServer
MLServer.SetVariable "Final_Number", first_number & second_number

You will now see a MLS variable called Final_Number with a value of 75. Note, this example is not addition.

Of course, in between the GetVariable and SetVariable you can do a million things with the data. I use MLScripts to do stuff that I don't want MLServer to have to wait for before continuing its execution of MLServer commands.

I think it would be great if folks would start sharing scripts but without cut/copy/paste in MLScripts it gets to be a lot of typing. :(

For anyone not familiar with vbscript, go to http://www.w3schools.com/vbscript/vbscript_intro.asp

Hope this helps.

Rick

worf83
Senior Member
Senior Member
Posts: 131
Joined: Mon Feb 14, 2005 11:40 am
Contact:

Postby worf83 » Wed Aug 27, 2008 10:58 pm

Rick,

Thank you very much, that makes sense.

Also, I agree, the ability to cut/copy/paste would be very helpful.

AL

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Postby CinemarDave » Wed Aug 27, 2008 11:35 pm

Worf

You had some misplaced quotes in your initial example. Here is your script with corrected quotes.

Code: Select all

option explicit
dim wShell
Set wShell = CreateObject ("WScript.Shell")
wShell.Run """C:\Program files\MLServer\MLServer.exe"" setVariable|aaa~88888", 1, false
Set WShell = Nothing


Copy and paste works fine for me in MLScript. Ctrl-C, Ctrl-V

worf83
Senior Member
Senior Member
Posts: 131
Joined: Mon Feb 14, 2005 11:40 am
Contact:

Postby worf83 » Thu Aug 28, 2008 7:28 am

CinemarDave wrote:Worf

You had some misplaced quotes in your initial example. Here is your script with corrected quotes.

Code: Select all

option explicit
dim wShell
Set wShell = CreateObject ("WScript.Shell")
wShell.Run """C:\Program files\MLServer\MLServer.exe"" setVariable|aaa~88888", 1, false
Set WShell = Nothing


Copy and paste works fine for me in MLScript. Ctrl-C, Ctrl-V


Dave,

The script worked, as you know... thank you.

Copy/paste also... fingers must not be working correctly.

AL


Return to “MLScript”

Who is online

Users browsing this forum: No registered users and 1 guest