User Forum    :: Powered by YaBB
  « MIDI-OX User Forum - Getting Started in Midi-OX and JScript »
Welcome, Guest. Please Login or Register.
May 9th, 2025, 8:50am


Home Home Help Help Search Search Members Members Login Login Register Register


   MIDI-OX User Forum
   MIDI-OX
   Scripting Questions
(Moderator: Jamie OConnell)
   Getting Started in Midi-OX and JScript
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Getting Started in Midi-OX and JScript  (Read 6249 times)
audell
New Member
*



MIDI-OX Rules!

   


Posts: 5
Getting Started in Midi-OX and JScript
« on: May 25th, 2003, 4:25pm »
Quote Quote Modify Modify

Hello...
 
I'm looking to use Midi-OX to a fascilitate the connection of external midi divices with a multimedia authoring package I'm currnently using called Anark Studio (http://www.anark.com).  Anark's scripting environment is completely based on Jscript, so based on what I'm reading, I believe that Midi-OX is the right tool for the Job.
 
I've been reading through the Midi-OX documentation and also learning JScript at the same time.
 
I understand that, based on the Midi-OX docs, it may be very easy to translate the concepts from VBscript to Jscript.  However, it has conceptually not been an easy task for me as of yet.
 
Does anyone here have any background in jscript and Midi-Ox to help baby step me in the right direction?
 
Thanks....
 
Alex
IP Logged
audell
New Member
*



MIDI-OX Rules!

   


Posts: 5
Re: Getting Started in Midi-OX and JScript
« Reply #1 on: May 26th, 2003, 6:39pm »
Quote Quote Modify Modify

Hello again...
 
okay...so I've made some progress...between the documentation of Midi-OX and the microsoft website refrence on Jscript and the book I've been studying: "JavaScript Your Visual Blueprint for building dynamic web pages"
 
I was able to come up with the following code frag:
 
<Script language="JavaScript">
 
MOX = new ActiveXObject("MIDIOX.MOXScript.1");
version = MOX.GetAppVersion();
middev = MOX.GetFirstSysMidiInDev();
 
document.write(version+"<br>"+middev);
 
The Above code  creates a few variables.
 
MOX - by assgining the 'ActiveXObject' to this variable, it actually creates the new running instance of Midi-Ox.
 
version - this variable is assigned to return the value of the current running version of Midi-Ox using Midi-Ox's 'built-in' GetAppVersion() method.
 
middev - this variable returns the value of the first midi input device connected to the system via Midi-Ox's built in GetFirstSysMidiInDev();
 
the document.write code basically writes the output of the variables to the current browser window.
 
WOO HOO....okay....so I have a brain...
 
But still sketchy on interacting with the Midi stream.
My very first idea is to simply write the incoming midi events as strings to the browser window.  I figure if I can make that connection happen...then I can fiure out how to manipulate it after that.
 
So I understand that the 'GetMidiInput()' is the specific method used to look at the incoming midi stream, however, I'm still not clear as to the supportive or backgournd elements necessary to get to this step.
 
For example:
 
The Mid-Ox documentation makes refrence to the VB frag  of:
-----------------------------------------------------
' Create object  
Set mox = WScript.CreateObject("MIDIOX.MOXScript.1", "OnTrigger_")  
 
 
This statement creates an object and tells WScript to generate calls to a method named OnTrigger_MidiInput(). System Exclusive data will trigger an OnTrigger_SysExInput(). You create a subroutine in your script with that name to receive MIDI data. "
 
------------------------------------------
 But I'm just not sure how this translates to Jscript.
Sure I could assign the OnTrigger_MidiInput() to a variable...but what would I do with it?  I'm thinking that this is going to be a function in jscript but I don't understand how to define it in relation to my original Midi-OX object...
 
 
Also the following:
 
----------------------------
 
"Data will not actually start flowing until you set the FireMidiInput property."
 
------------------
So I assume I need a statement in the script that sets this value to 1 like:
 
MOX.FireMidiInput = 1
 
I know I'm very close here....I see all these small pieces...I just am not quite clear on how they go together in Jscript to make this happen.....
 
If anyone has any insight it would be much appreciated.
 
Thanks again,
 
Alex
IP Logged
Jamie OConnell
Administrator
*****






   
WWW Email

Gender: male
Posts: 2027
Re: Getting Started in Midi-OX and JScript
« Reply #2 on: May 28th, 2003, 11:35am »
Quote Quote Modify Modify

There is a JavaScript (Windows Script Host) sample that is installed with MIDI-OX.  Look in the WSH folder under MIDIOX for Breath2NRPN.js.  It demonstrates using connection point sinks, and should work right out of the box.
IP Logged

--Jamie
Music is its own reward.

audell
New Member
*



MIDI-OX Rules!

   


Posts: 5
Re: Getting Started in Midi-OX and JScript
« Reply #3 on: May 28th, 2003, 11:42am »
Quote Quote Modify Modify

Jamie...
 
of course it would be right in front of my face. Roll Eyes
 
I'll take a look!
 
Thanks...
 
Alex
IP Logged
audell
New Member
*



MIDI-OX Rules!

   


Posts: 5
Re: Getting Started in Midi-OX and JScript
« Reply #4 on: Jun 19th, 2003, 11:28am »
Quote Quote Modify Modify

Hi Jamie and all...
 
OK, I'm guessing I need to be a bit more clear.
 
I'll need to access Midi-OX from Internet Explorer.
 
According to other sources WSH and Internet Explorer treat Jscript a bit differently.  By default Wscript is 'Undefined' when accessed from IE.
 
Can you help me with some fundamental ground work to launch Midi-OX from IE so I can gather the incoming midi stream and parse the data?  
 
I'll assume it's better to keep the actual Midi OX script as an external document so I can resue it from different HTML docs in a modular 'Object' fashion.  
 
Thanks....sorry for being such a newbie to all of this.  But only thru this am I getting a much clearer picture of the direction I need to go.
 
Alex Udell
IP Logged
audell
New Member
*



MIDI-OX Rules!

   


Posts: 5
Re: Getting Started in Midi-OX and JScript
« Reply #5 on: Jun 22nd, 2003, 12:22pm »
Quote Quote Modify Modify

OK....Shifting basic concept here....
 
The structure as I've been thinking about it is that I have wanted to centralize the structure of the code around the HTML document.
 
However, the more I think about it, in my scenario the HTML document is really only an Output window.
 
So perhaps I should structure this as a standard jscript document which is responsible for laubnching MIDI OX, parsing the stream and sending it out to the HTML doc....
 
Does this sound right?
 
Thanks,
 
Alex
IP Logged
Jamie OConnell
Administrator
*****






   
WWW Email

Gender: male
Posts: 2027
Re: Getting Started in Midi-OX and JScript
« Reply #6 on: Jun 22nd, 2003, 4:02pm »
Quote Quote Modify Modify

Truthfully, I have no experience trying to use MIDI-OX scripting with I.E. or any other browser.  Assuming that they have methods for creating objects, there should be a similar mechanism available as there is in WSH.  It could be that connection point sinks are not available, in which case you'd have to use the polling method to obtain input.
 
Your last message sounded correct from a theoretical soundpoint.
IP Logged

--Jamie
Music is its own reward.

Peter L Jones
Expert
*****




Hit it

   
WWW

Gender: male
Posts: 978
Re: Getting Started in Midi-OX and JScript
« Reply #7 on: Jun 23rd, 2003, 6:00pm »
Quote Quote Modify Modify

I think (I dabbled with WSH/IE/JScript ages ago, so I may misremember) that there's an OCX control for WSH that you need to embed in an HTML document (<OBJECT> tag?).  I never got it to work but I didn't try very hard.
 
You should always treat the web page as no more (and no less) than a fancy dumb terminal.  Your core program structure should merely expose methods on objects that any consumer of that service might like to invoke.  Easier said than done, though... Smiley
IP Logged

"...Playing fast around the drums is one thing. But to play with people for others, to listen to, that's something else. That's a whole other world." -- Tony Williams
pete
New Member
*



MIDI-OX Rules!

   


Posts: 3
Re: Getting Started in Midi-OX and JScript
« Reply #8 on: Oct 25th, 2003, 8:26am »
Quote Quote Modify Modify

I want to try and do a similar thing, using IE as a terminal for a sript associated with MIDI OX.
I've been thinking that it might be a good solution to instantiate IE through its automation interface, using the WS.  I'm only just looking into it, but heres a basic script to get IE up and running:
 
 
var sProgID = "InternetExplorer.Application";
var objIE = WScript.CreateObject(sProgID, "IE_");
var objDoc;
 
 
function IE_DocumentComplete()
{
  with (objIE) {
    AddressBar = false;
    ToolBar = false;
    MenuBar = false;
    StatusBar = false;
    Width = 400;
    Height = 450;
  }
 
  objIE.Visible = true;
 
  
  objDoc = objIE.Document;
  objDoc.title = "hello";
 
  objDoc.open();
  objDoc.write("output info...");
  objDoc.close();
}
 
objIE.Navigate("about:blank");
 
 
// evil hack: prevent race condition.  Must be a better way.
WScript.Sleep(100);

 
 
 
 
p.s. Thanks for a brilliant App, Jamie
 
« Last Edit: Oct 25th, 2003, 8:27am by pete » IP Logged
pete
New Member
*



MIDI-OX Rules!

   


Posts: 3
Re: Getting Started in Midi-OX and JScript
« Reply #9 on: Oct 26th, 2003, 10:14am »
Quote Quote Modify Modify

I've had a go at doing something a little more complicated...
 
ZoneControl.zip
IP Logged
Jamie OConnell
Administrator
*****






   
WWW Email

Gender: male
Posts: 2027
Re: Getting Started in Midi-OX and JScript
« Reply #10 on: Oct 26th, 2003, 7:53pm »
Quote Quote Modify Modify

Thanks for providing a sample.  That may help some folks get going.
IP Logged

--Jamie
Music is its own reward.

pete
New Member
*



MIDI-OX Rules!

   


Posts: 3
Re: Getting Started in Midi-OX and JScript
« Reply #11 on: Nov 2nd, 2003, 2:42pm »
Quote Quote Modify Modify

Smiley
 
Ive updated it a bit, so you can save presets and transpose zones independently.  It's a bit more efficient at communicating from IE to the script running with WSH...
 
ZoneControl2
 
« Last Edit: Nov 2nd, 2003, 2:43pm by pete » IP Logged
sveex
New Member
*



MIDI-OX Rules!

   


Posts: 4
Re: Getting Started in Midi-OX and JScript
« Reply #12 on: Jun 29th, 2005, 1:49am »
Quote Quote Modify Modify

Found this thread by searching Google for the ability to map keyboard zones in software.  MIDI-OX + Pete's ZoneControl script is pretty much exactly what I was looking for, and the only thing I could find other than a Cakewalk plugin called JamBuddy.  It would be nice if ZoneControl could layer/overlap channels, but this can be accomplished by running multiple instances.
 
I wish these features existed on more controllers and sequencers.  Does anyone know of any dedicated hardware or software that can zone/layer channels?
 
Thanks to Pete for the wonderful script.  Looks like it took some time to make.
 
-Sveex Cool
IP Logged
initself
New Member
*




MIDI-OX Rules!

   


Posts: 3
Re: Getting Started in Midi-OX and JScript
« Reply #13 on: Jan 6th, 2009, 2:01pm »
Quote Quote Modify Modify

I am having trouble running certain methods shown in the MOXScript API.  Here is my sample code:
 
Code:

// Jscript MIDI-OX Test
 
var sMox_ID = "Midiox.MoxScript.1";
var objMOX = WScript.CreateObject(sMox_ID, "OnMOX_");
 
objMOX_Start();
 
function objMOX_Start() {
  objMOX.DivertMidiInput = 1;
  objMOX.FireMidiInput = 1;
  var test = objMOX.InstanceNumber;   // works
  var test = objMOX.SysMidiInCount;   // works
  var test = objMOX.GetFirstSysMidiInDev;  // Object doesn't support this property or method
  WScript.Echo(test);
}
 
function objMOX_Cleanup() {
  objMOX.FireMidiInput = 0;
  objMOX.DivertMidiInput = 0;
  objMOX = null;
}
 

 
Why doesn't the GetFirstSysMidiInDev method work in JScript?
 
Thanks,
 
mb
IP Logged
JerryJorgenrud
New Member
*



MIDI-OX Rules!

   


Posts: 0
Re: Getting Started in Midi-OX and JScript
« Reply #14 on: Jan 7th, 2009, 8:59am »
Quote Quote Modify Modify

objMOX.GetFirstSysMidiInDev()
 
Note brackets, used when calling methods ...
IP Logged
monkeyboi
New Member
*



MIDI-OX Rules!

   


Posts: 9
Re: Getting Started in Midi-OX and JScript
« Reply #15 on: Mar 16th, 2010, 3:35pm »
Quote Quote Modify Modify

Using MSIE as a terminal for WSH scripts doesn't circumvent browser security. I still get nagged to install OCX controls. Windows HTML Application (HTA) Host solves this problem by putting MSIE into a special mode that has the same access to your system as any other Windows app. Simply add the <HTA:APPLICATION> tag to an HTML page and save it as an .hta file.
 
http://msdn.microsoft.com/en-us/library/ms536496%28VS.85%29.aspx
IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »


MIDI-OX User Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.