Skip to Main Content Skip to Search
Login
File Exchange
MATLAB Newsgroup
Link Exchange
  Blogs  
 Contest 
MathWorks.com

Thread Subject: Calling Javascript function from Matlab

Subject: Calling Javascript function from Matlab

From: Michele

Date: 13 Oct, 2007 06:06:14

Message: 1 of 4

I have a Z-Wave home automation controller that comes with a
web server that offers up a page with buttons like "ON" and
"OFF" for controlling lights. These buttons run Javascript
functions so for example, when you mouse-click the OFF
button in the browser it runs this Javacript:
onclick="goOff(1);"

I want to control the hardware with Matlab, but my only
interface is via the web server. Is this even possible? Is
there some way for me to have Matlab execute a "goOff(1)"
command or any of the other Javascript functions defined on
the web page?

Seems like it ought to be possible, but I'm drawing a blank
on how to get Matlab to run the Javascript. Any help would
be most appreciated. Thanks!

Subject: Re: Calling Javascript function from Matlab

From: Michele

Date: 20 Oct, 2007 15:43:45

Message: 2 of 4

Hmmm - no replies. Maybe I'm asking the wrong question.
How about this:

Is there a way in Matlab to generate httpWebRequest and
httpWebResponse objects?


Subject: Re: Calling Javascript function from Matlab

From: Yair Altman

Date: 20 Oct, 2007 16:32:46

Message: 3 of 4

"Michele " <denber.nospam@mindspringNOSPAM.com> wrote in
message <ffd7nh$j3p$1@fred.mathworks.com>...
> Hmmm - no replies. Maybe I'm asking the wrong question.
> How about this:
>
> Is there a way in Matlab to generate httpWebRequest and
> httpWebResponse objects?


You might try using Internet Explorer's COM server object
(search this forum for examples - there was even one a few
days ago if I remember correctly). Or use Java's net I/O
classes. Or use Matlab's browser for that matter.

Yair Altman
http://ymasoftware.com

Subject: Re: Calling Javascript function from Matlab

From: Michele

Date: 21 Oct, 2007 06:03:14

Message: 4 of 4


> You might try using Internet Explorer's COM server object
> (search this forum for examples - there was even one a few
> days ago if I remember correctly). Or use Java's net I/O
> classes. Or use Matlab's browser for that matter.

Thankw very much for the suggestions. I started off trying
to do a web call, but the page I need is password protected.
 This is similar to the problem I had earlier with urlread.
 Unfortunately, unlike urlread, all web seems to do is call
ibrowse(html_file), and ibrowse is a dll.

I also tried searching for "IE com server object" and it
told me those were all common terms and wouldn't give me any
results.


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
javascript Michele 13 Oct, 2007 02:10:07
web browser Michele 13 Oct, 2007 02:10:07
function call Michele 13 Oct, 2007 02:10:07
rssFeed for this Thread

envelope graphic E-mail this page to a colleague

Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.
Related Topics