Champak

Javascript executing autoit function

4 posts in this topic

Is it possible to execute an autoit function from within javascript?

ex. I have the following listener

"        google.maps.event.addListener(directionsDisplay, 'directions_changed', function() {" & @CRLF & _
                "            computeTotalDistance(directionsDisplay.directions);" & @CRLF & _
                "        });" & @CRLF & _

and I want to put an autoit function after computeTotalDistance. When I tried different variations, nothing happened or it killed the javascript. It's odd to me, because I've incorporated things from the autoit environment into the javascript, like string conversions of words and letters, or words within arrays[0], but I can't seem to execute functions, or even get a msgbox to pop up.

Share this post


Link to post
Share on other sites



Yes , it is possible. But i cant understand what exactly you want to do. Start an autoit function when the event is fired ?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Yes, exactly. I've tried things like this.

"        google.maps.event.addListener(directionsDisplay, 'directions_changed', function() {" & @CRLF & _
"            computeTotalDistance(directionsDisplay.directions);" & @CRLF & _
" " & myfunc() & @CRLF & _
"        });" & @CRLF & _

And

"        google.maps.event.addListener(directionsDisplay, 'directions_changed', function() {" & @CRLF & _
"            computeTotalDistance(directionsDisplay.directions);" & @CRLF & _
" " & myfunc() & ";" & @CRLF & _
"        });" & @CRLF & _

 

And other variations. I actually used a msgbox instead of myfunc() for the testing.

Edited by Champak

Share this post


Link to post
Share on other sites

Can you post your full AutoIT code ? I think you are mixing AUTOIT with Java code. I guess you are trying to convert google API examples like the one bellow?

function initMap() {
  var map = new google.maps.Map(document.getElementById('map'), {
    zoom: 4,
    center: {lat: -25.363882, lng: 131.044922 }
  });

  map.addListener('click', function(e) {
    placeMarkerAndPanTo(e.latLng, map);
  });
}

function placeMarkerAndPanTo(latLng, map) {
  var marker = new google.maps.Marker({
    position: latLng,
    map: map
  });
  map.panTo(latLng);
}

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now