Champak Posted March 2, 2016 Posted March 2, 2016 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.
Juvigy Posted March 2, 2016 Posted March 2, 2016 Yes , it is possible. But i cant understand what exactly you want to do. Start an autoit function when the event is fired ?
Champak Posted March 2, 2016 Author Posted March 2, 2016 (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 March 2, 2016 by Champak
Juvigy Posted March 2, 2016 Posted March 2, 2016 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); }
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now