LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Controling Java Button in Web browser - PLEASE HELP!!

Solved!
Go to solution

Hi,

 

I just started using LabView and i read almost every post but i couldn't find what i am looking for. So if i run the Vi (picture_2) i get in innerHTML indicator structure of HTML for my example:

 

<TABLE cellSpacing=0 width="100%" align=left>
<TBODY>
<TR>
<TD><A href=".\View.htm" target=viewframe><B>Home</B></A>&nbsp;<B>|</B>&nbsp; <A id=START onclick="ExecuteAction('a.wsdl',1)" href="#">START</A>&nbsp;<B>|</B>&nbsp; <A style="BACKGROUND-COLOR: lightblue"</A>
<B>Version: 2.000<BR>Build: 20110110</B></TD>
<TD align=right></TD></TR></TBODY></TABLE>

 

Here is where i can't find a way to press button START with ActiveX function. I know how to simulate mouse position and mouse click but i need ActiveX function only.

I found in ActiveX this Onclick function but i just can't get it to work (what do i need to write in (???????) and if i need more data to properly control the function.

 

 

Can somebody please help me with my proble?

 

 

Thanks

 

Picture_1 - Example of web browser page

Test.jpg

 

 

Picture_2 - source code

 

Test (2).jpg

0 Kudos
Message 1 of 17
(4,623 Views)

Hi TRM,

did you try the "submit" command?

 

Mike

0 Kudos
Message 2 of 17
(4,587 Views)

Hi Mike,

 

thanks for your reply!

I don't exactly know what you mean with "submit" command (can you give me some example)?

I thought that what i get from the page (innerHTML indicartor) will help me to call START function easily but i don't know how. I found out that there is also one javascript running in the back

and there are also some functions in it :

 

var xmlhttp
try
{  // Firefox, Opera 8.0+, Safari
  xmlhttp=new XMLHttpRequest();
}
catch(e)
{  // Internet Explorer
  try
  {
    xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
  catch(e)
  {
    try
    {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch(e)
 {
   alert("Your browser does not support AJAX!");
    }
  }
}
function ExecuteAction(url,action)
{
    var aref=null
    var itemId = ""
    switch(action)
    {
        case 1: itemId="START"; break;
    }

    aref = document.getElementById("START").style.backgroundColor="lightblue"
      
    xmlhttp.open("POST", url, true);
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4) {
            var xxml = xmlhttp.responseXML.documentElement............

.............

Is there some option for me to call this javascript and this function getElementById. I tried this way and i can't get it to work?

 

Thanks for reply

0 Kudos
Message 3 of 17
(4,576 Views)

Hi TRM,

sorry, submit is only possible if you use forms in your html page.

Is the page you want to command online reachable?

 

Mike

0 Kudos
Message 4 of 17
(4,563 Views)

Yes it is Mike!

 

TRM

0 Kudos
Message 5 of 17
(4,559 Views)

Hi TRM,

 

according to your code from Picture_2 you are dealing with ActiveX item from Microsoft Explorer.

 

So you should look at the documentation of this ActiveX at www.msdn.com especially:

 

http://msdn.microsoft.com/en-us/library/aa752127(VS.85).aspx

 

This issues is more connected with handling this ActiveX, that programming in LV. The programming for this ActiveX will be the same from LV, VB, C#, Python... 

 

Kind Regards,

 

Jiri Keprt

NI Czech Republic

CLA, CTA

0 Kudos
Message 6 of 17
(4,538 Views)

Hi, Jiri Keprt

 

thanks for your replay! I will take a look at this link. If i understand you correctly you mean that i probably need to find something as the right syntax for my code to be working?

 

Kind Regards,

TRM

0 Kudos
Message 7 of 17
(4,507 Views)

HI TRM,

Could you please add your VI to the post? 

 

Thanks,

Siva

0 Kudos
Message 8 of 17
(4,491 Views)

HI Siva,

 

here is Vi!

 

P.S.

 

Just for the testing i use www.google.com in URL box, because innerHTML shows me the same type of functions (onclick) that i try to interact with my program.

Thanks,

TRM

0 Kudos
Message 9 of 17
(4,485 Views)

Hi TRM,

 

simplified you can look at the ActiveX item like on library with functions. LV does only interface to this library.

 

ActiveX and LabVIEW

 

F.e. Navigate method is described here. Look at you G code, that invoke node Navigate has the same parameters.

 

So, you have to find in the documentation of the ActiveX what is the function, you are searching for, what is the right syntax and what data you should provide as input. 

 

The easiest way is to find example in visual basic, because the name of the functions are closest to LV. 

 

Regards,

 

Jiri

CLA, CTA

0 Kudos
Message 10 of 17
(4,443 Views)