LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Having problem with calling external javascript functions in LV

Hi,

 

I found this VI: http://lavag.org/topic/10304-discuss-calling-external-javascript/, which I believe can be really helpful for my work. The problem is I can't get it to run based on the following problem:

 

 - Apparently the "ScriptControl" cannot be loaded

 

I am using LabView 8.6, and this vi has been produced in a 8.0 version. Do you think this is the problem? If not, what could cause this problem running this VI?

 

Thanks,

Diogo

0 Kudos
Message 1 of 10
(4,172 Views)

Hi Diogo,

i don't think this is the problem. I can run it with LabVIEW 8.5 without any problems. Maybe there are some ActiveX functions missing on your pc.

 

Mike

0 Kudos
Message 2 of 10
(4,166 Views)

Hello,

 

Can you find the Script Control Object when inserting an ActiveX Control ?

 

Regards,

0 Kudos
Message 3 of 10
(4,150 Views)

Hi,

 

Yes I can find the ScriptControl Object when inserting an ActiveX control. I openned a blank VI, created an activeX container and found it when searching activex objects. However when I choose to insert I get an error, something like (it's in portuguese so i'm going to try an translate as accurate as I can): " Error inserting ActiveX or .NET object: Error loading library/DLL of types".

 

Is it possible I need to install some library to be able to use this object?

 

Thanks for your support.

 

Diogo

0 Kudos
Message 4 of 10
(4,144 Views)

Hello,

 

Can you post a screenshot of this error ?

 

Regards,

0 Kudos
Message 5 of 10
(4,132 Views)

Hi,

 

here are two printsreens of the problem.

 

 

 

calling external javascript error1.jpg

 

This is the error I get when I try to run it.

 

However, in the next image, when it is not running, you can see in the front panel the ScriptControl, where it says "Control could not be loaded".

 

calling external javascript error2.jpg

 

I think that the this message is the real problem... Hope you can help me and many thanks once again.

 

Diogo

0 Kudos
Message 6 of 10
(4,127 Views)

Hello,

 

After some investigations, it seems that this issue is related to the ActiveX and nothing can be done to help with this VI. Maybe you could get in touch with the developper ?

 

Moreover, can you tell me what you want to do exactly ? I think that using JavaScript to write data to an xml file is a bit complicated, maybe we could find another way to do what you are expecting.

 

Have a nice day !

 

Regards,

Message Edité par Maxime MULLER le 07-20-2009 10:21 AM
0 Kudos
Message 7 of 10
(4,110 Views)

Hi,

 

First of all thank you for your effort in trying to help me solve this problem.  I am going to try and explain what it is I want to do. I am developing an UAV ground station, in which I receive data from the GPS and other sensors via serial communication.

 

What I want to do is plot my gps data in google maps, positioning the center of the map always in the coordinates I get from the GPS NMEA data that I parse in Labview. I have seen examples even in this forum where static maps are used. I tried this but it is not a good solution because the URL as to be constantly changed with the latitude and longitude data and the page reloaded. It causes extreme flickering. So I want to use the Google Maps API in my labview application. The problem is that I have to call the API's javascript functions, with arguments like the lat and longitude data I get from the GPS.

 

I tried embedding an webbrowser and putting all the javascript code in a html file. That way when I load the html file in the URL of the browser the map api is loaded. The problem is this strategy prevents me from calling the javascript funtions (for example "mapcenter" function) for sending my coordinates information and other. So my real problem is interacting between the labview environment and the javascript code. If I can do this, I do not need to be constantly reloading the map, and the map movement is smooth and dynamic.

 

I hope you can help me go a little further in this issue. Thank you very much.

 

Diogo

0 Kudos
Message 8 of 10
(4,106 Views)

Hi again !

 

Is it possible for you to send us the API ? Or just the main part ?

 

Regards,

0 Kudos
Message 9 of 10
(4,104 Views)

Hi,

 

To start I am using this examplo from the google code page.

 

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
   
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   
<title>Google Maps JavaScript API Example</title>
   
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
           
type="text/javascript"></script>
    <script type="text/
javascript">

   
function initialize() {
     
if (GBrowserIsCompatible()) {
       
var map = new GMap2(document.getElementById("map_canvas"));
        map
.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map
.setUIToDefault();
     
}
   
}

   
</script>
 
</head>
 
<body onload="initialize()" onunload="GUnload()">
   
<div id="map_canvas" style="width: 500px; height: 300px"></div>
 
</body>
</html>

 

 

It loads a basic map, and is saved in a html file created for example in Notepad. Basically as I said the VI is very simple, see next image.

 

maps api.jpg

 

But like I said, this strategy does not allow labview to interface dinamically with the javasscript code in the html file. Doing it this way, I would have to constantly update the code in the file with new coordinates and loading the map again. This causes the mentioned flickering problem that I also had with static maps.

 

Diogo

0 Kudos
Message 10 of 10
(4,099 Views)