Version 1.0.0.0 alpha (April 6, 2000)
-- FREE ActiveX Control for MathLink--ActiveML is a free ActiveX control for MathLink, which can connect to a Mathematica kernel, make the kernel evaluate a string, obtain its result from the kernel, and disconnect the link to the kernel. If a graphic command is invoked, its result can be displayed on the control.
Since it uses ActiveX technology, you can use ActiveML with Internet Explorer, Visual Basic, Excel, PowerPoint, Windows Scripting Host, and many other Windows programs.
ActiveML can be used only in Windows 95/98/NT/2000.
Much Smaller in Size: The file size of this new version is about a quarter of that of the previous version.
Returning Mouse Positions: The new control returns a mouse position when a mouse button is clicked on the control (thanks to the comments from Dr. Roberto Abraham in July 17, 1999)
Distribution: The new control is distributed with its file uncompressed and installation described in the English language, to avoid inconvenience to the non-Japanese user. The previous version has been distributed with LZH compressed format and the message of the installer was in Japanese.
Incompatibility: Some properties are removed and some property names are changed, because the previous version was developed with Delphi while this new version with Visual C++ and ATL. To circumvent confusion, the control name is changed from the previous name "ActiveMathLink" to the new name "ActiveML." Be careful when you try to run previous client programs; you probably have to change your client source code.
The properties, methods and event of ActiveML are listed below:
Obsolete properties are also listed and clearly stated as (Obsolete). New properties are marked as (New).
Property | Description |
Appearance | (New) The appearance of the control's border: Flat when it is false; 3-D when true |
AutoSize | (New) When true, the control is automatically resized to display its entire contents. |
BackColor | (New) Background color |
BackStyle | (New) Background style |
BGColor |
(Obsolete) Use BackColor instead |
BorderColor | (New) Border color |
BorderStyle | (New) Border style |
BorderVisible | (New) When true, the control's border is displayed. |
BorderWidth | (New) The width of the control's border |
Connected |
If true, the control is connected to the kernel. |
DisplayTextColor |
(Obsolete) Use ForeColor instead |
DisplayTextQ |
If true, the evaluation result is also displayed on the control; if false, it is not. |
Enabled | (New) When false, the control is disabled |
Font | (New) Specify font of the control. It is valid when DisplayTextQ is true |
ForeColor | (New) Foreground color of the font on the control |
Height |
(Obsolete) |
InitString |
Initial string to be evaluated when a Mathematica kernel is loaded and connected Default string is as follows:
|
Left |
(Obsolete) |
MathIn |
Input string to be evaluated by the kernel |
MathMsg |
Message string from the kernel |
MathOut |
Output string or evaluation result |
MLParms |
Path to the kernel Default string is as follows:
|
Stretch |
If true, an image is stretched to the size of the control; if false, it is not. |
Top |
(Obsolete) |
Width |
(Obsolete) |
There is no change in the method names.
Method |
Description |
Connect |
Connect to the kernel |
Disconnect |
Disconnect the link |
Evaluate |
Evaluate an input string in MathIn and get a result in MathOut |
Stop |
Stop an evaluation process |
The following event did not exist in the previous version, so it is marked as (New).
Event |
Description |
MouseClicked(x, y) |
(New) The event when the mouse left button is clicked. this event is fired and returns the horizontal and vertical position of the mouse, x and y |
ActiveML was tested with Mathematica 3.0.1.1 under Windows 98/2000 Professional Japanese version, and has been working all right with Visual Basic 6.0, Internet Explorer 4/5, Excel, PowerPoint, and Windows Scripting Host.
ActiveML is FREE! Your comments are always welcome.
Download the file.
Place the downloaded file to your favorite directory (for example, "\windows\system")
With MS-DOS prompt screen, execute
"\pathname1\regsvr32 \pathname2\activeml.ocx" with properly adding
pathnames in your environment. For example, when you have placed the control
in the "\windows\system" directory and regsvr32.exe exists in "\windows\system", you execute
\windows\system\regsvr32 \windows\system\activeml.ocx
If you get an error message during the installation, be sure that you have
"ml32i2.dll" in your system directory (for example, in
"\windows\system"). You can get ml32i2.dll from http://support.wolfram.com/MathLink/Updates/MLDK.html.
Execute "\pathname1\regsvr32 /u \pathname2\activeml.ocx" with a command option /u.
Delete the file activeml.ocx.
The first sample demonstrates how to use ActiveML with Internet Explorer 5.0.
First, type (or copy/paste) the following HTML source code and save it.
<HTML>
<HEAD><TITLE>ActiveML</TITLE></HEAD>
<BODY BGCOLOR=#E8E8E8>
<TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR ALIGN="center">
<TD VALIGN="center" BGCOLOR=#4040C0><FONT SIZE=5 COLOR=#FFFF00><I>ActiveML</I></FONT>
</TD>
</TR>
</TABLE>
<BR><CENTER><INPUT TYPE="button" NAME="ConnectBtn" VALUE="Connect">
<INPUT TYPE="button" NAME="EvaluateBtn" VALUE="Evaluate">
<INPUT TYPE="button" NAME="DisconnectBtn" VALUE="Disconnect">
<INPUT TYPE="button" NAME="StopBtn" VALUE="Stop">
</CENTER><BR>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad() 'When the page is loaded
ActiveML.BackColor=&HF0F0F0 'Set the background color of the ActiveX control
ActiveML.Stretch=1 'Stretch images to the size of the control
ActiveML.Appearance=1 '3-D border style
ActiveML.DisplayTextQ=1 'Display the result on the control
ActiveML.MLParms="-linklaunch -linkname " & Chr(39) & "C:\Program Files\Mathematica\3.0\MathKernel.exe" & Chr(39) 'Set the Mathematica kernel pathname
End Sub
Sub ConnectBtn_OnClick() 'Connect to the Mathematica kernel
ActiveML.Connect
End Sub
Sub DisconnectBtn_OnClick() 'Disconnect the link to the Mathematica kernel
ActiveML.Disconnect
End Sub
Sub EvaluateBtn_OnClick() 'Evalution
If ActiveML.Connected Then 'If the control is connected to the kernel
ActiveML.MathIn=Input.Value 'Input is the input string. Copy it to MathIn.
ActiveML.Evaluate 'Invoke the evaluation command
Out.Value=ActiveML.MathOut 'Get the result in MathOut and copy it to Out.
Else 'If the control is not yet connected to the kernel
MsgBox "Not connected to Kernel yet.",0,"Connection error" 'Display the error message
End If
End Sub
Sub StopBtn_OnClick()
ActiveML.Stop
End Sub
-->
</SCRIPT>
<CENTER>
<FONT SIZE=3 COLOR=#995599>Input:</FONT><BR>
<TEXTAREA NAME="Input" Rows=2 Cols=50></TEXTAREA><BR>
<FONT SIZE=3 COLOR=#995599>Output:</FONT><BR>
<TEXTAREA NAME="Out" Rows=3 Cols=50></TEXTAREA>
<BR><BR>
<OBJECT ID="ActiveML" WIDTH=350 HEIGHT=200 CLASSID="CLSID:AFAEAA62-054C-11D4-8A95-00400535F9E7"
<param name="Appearance" value="1">
<param name="AutoSize" value="0">
<param name="BackColor" value="16777215">
<param name="BackStyle" value="0">
<param name="BorderColor" value="0">
<param name="BorderStyle" value="0">
<param name="BorderVisible" value="1">
<param name="BorderWidth" value="1">
<param name="Enabled" value="-1">
<param name="Font" value="System">
<param name="Stretched" value="1">
<param name="ForeColor" value="0">
>
</OBJECT>
</CENTER>
</BODY>
</HTML>
Execute the code or read it from Internet Explorer, and you get:
Press the [Connect] button and the control will be connected to the kernel. Type your command in the [Input] box. Press the [Evaluate] button, and you get its result in the [Output] box.
Images can be displayed on the control. If you invoke a Plot command, you get a graph on the control.
If the DisplayTextQ property is true (or 1; DisplayTextQ=1 in the source code above), evaluation results are displayed also on the control.
Add the following code (between "End Sub" and "-->", for example) and click the left mouse button on the control, and you will get the horizontal and vertical positions where the mouse button is clicked. The positions are measured in pixel from the top left corner.
Sub ActiveML_MouseClicked(x,y)
Out.Value="the horizontal position:" & x & Chr(13) &Chr(10) & " the vertical position:" & y
End Sub
By pressing [Disconnect], the link to the kernel is disconnected.
The second sample demonstrates how to use ActiveML with Windows Scripting Host (WSH).
Note: Windows Scripting Host (WSH) is installed with Windows 98/2000. In Windows 95, you have to install WSH from Microsoft Web site.
First, type (or copy/paste) the following source code and save it with ".vbs" file extension (for example, test.vbs). Double-click the file in Explorer. After inputting an expression in an input box, you will get the result in a message box.
Sub Compute()
Dim AMLobj
set AMLobj=CreateObject("ActiveML.AMLCtrl.1")
AMLobj.MLParms="-linklaunch -linkname " & Chr(39) & "C:\Program Files\Mathematica\3.0\MathKernel.exe" & Chr(39) 'Set the Mathematica kernel pathname
AMLobj.Connect
AMLobj.MathIn=InputBox("Input an expression")
AMLobj.Evaluate
MsgBox AMLobj.MathIn & " = " & Chr(10) & Chr(13) & AMLobj.MathOut
set AMLobj=Nothing
end sub
Compute
Double click the saved file and type "100!" in:
After pressing the [OK] button:
The control cannot handle special characters and characters other than ASCII.
Microsoft Word cannot recognize the "Evaluate" and "Stop" methods of the control name.
If you have comments or suggestions, please send e-mail to me.
If you have interesting ideas how ActiveML is used, please let me know by sending e-mail to me.
Visual Basic sample program “Mini FrontEnd” included in MathLink Developer’s Kits.
April 6, 2000 (c)Yuji Itaya