octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using Javascript and Browsers for Octave UI- Sorry, Misposted


From: BrowseOct
Subject: Re: Using Javascript and Browsers for Octave UI- Sorry, Misposted
Date: Tue, 22 Jan 2008 17:13:34 -0800 (PST)

Update sample - Also tested in Freemat and Matlab 7.1

File 1 octave2.js

//************************************************ 
// File:    Form1.js (WSH sample in JScript) 
// Author:  (c) G. Born modified for octave 
// 
// Using Internet Explorer 4 or 5 to retrieve 
// form input 
//************************************************ 
var Text2 = "You entered:\n"; 

// Launch Internet Explorer, and connect event handler. 
var oIE = WScript.CreateObject("InternetExplorer.Application", "IE_"); 

oIE.Left = 50;           // Window position and other properties 
oIE.Top = 100; 
oIE.Height = 100; 
oIE.Width = 280; 
oIE.MenuBar = 0;         // No menu 
oIE.ToolBar = 0; 
oIE.StatusBar = 0; 
// Commented out because it causes a corrupted window border. 
// oIE.Resizable = 0     // Disable resizing. 
oIE.navigate(GetPath() + "Form1.htm");  // Load form. 
oIE.Visible = 1;         // Keep visible. 

// Important: Wait until IE is ready. 
while (oIE.Busy) {WScript.Sleep(200)}  // Suspend 

var ready = false;      // Form is still open. 
    
// Wait until the user closes the form using 
// the Close button in the upper right corner of the window. 
// This sets ready to true in the onclose event. 
while (!ready) {WScript.Sleep(500)}  // Suspend 

// Display the data obtained in the event handling procedure. 
WScript.Echo("<OCTDATA>\n"+name + "\n" + age); 

// We're ready now. The sample script terminates. 
// Here you can add script-specific code. 

// Event handler and helper 

function IE_OnQuit() 
{ 
    // Event handler is called if IE terminates. 
    // This happens if the user clicks the Close button. 
    // Retrieve the values. 
    name = "Name: " + oIE.Document.ValidForm.fName.value; 
    age = "Age: " + oIE.Document.ValidForm.fAge.value; 
    ready = true;        // Indicate form is closed. 
} 

function GetPath() 
{ 
    // Get script path because form (HTML file) 
    // must be in the same folder. 
    var path = WScript.ScriptFullName; 
    path = path.substr(0, path.lastIndexOf("\\") + 1); 
    return path; 
} 

//*** End 



File Form1.htm

<HTML> 
<form name="ValidForm"> 
    <p> 
        Name:   
        <input type="text" size="5" name="fName">   
        Age:   
        <input type="text" size="3" name="fAge"> 
        <br> 

        Password:   
        <input type="password" size="12" maxlength="8" name="fPassw"> 
            
        <input type="button" name="Button1" value="OK"
onclick="javascript:window.opener='x';window.close();" > 
        <br>  The OK button fixed (close the browser instead) and look at
the output variable. 

        <input type="checkbox" name="fPrinter" value="1" checked> 
        Printer   
        <input type="checkbox" name="fScreen" value="2"> 
        Screen 
        <br> 

        Remarks: 
        <br> 

        <textarea cols="40" rows="5" name="fRemark"> 
        </textarea> 
    </p> 
</form> 
</HTML> 


-- 
View this message in context: 
http://www.nabble.com/Using-Javascript-and-Browsers-for-Octave-UI--Sorry%2C-Misposted-tp15023055p15032819.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]