Page 1 of 1

trying to call iMacros from javascript

Posted: Fri Mar 27, 2009 4:47 pm
by gavicus
I'm trying to call imacros from an html page with javascript rather than just running a .js from the firefox plugin (which has certain limitations). Anyway, I found the code attached below and tried it out, but I get the error message: "Automation server can't create object" from the line that sets iim1 to a new ActiveXObject. Has anyone been able to make this work?

On the imacros wiki:
http://wiki.imacros.net/JavaScript
I found the following code:

<html>
<body>

<script type="text/javascript">
<!--
function runimacros() {
var iim1 = new ActiveXObject("imacros");
var iret

iret = iim1.iimInit("-fx");
iret = iim1.iimDisplay("This is a test");
iret = iim1.iimPlay ("Demo-FillForm");
iret = iim1.iimExit();
}
//-->
</script>

<a href="javascript:runimacros()">Click to run iMacros</font></a>
</body>
</html>

Re: trying to call iMacros from javascript

Posted: Mon Mar 30, 2009 3:56 pm
by Marcia, Tech Support
Hello,
Has anyone been able to make this work?
Yes. It works fine in Internet Explorer. As already mentioned on the wiki page with the code, you must open this page in Internet Explorer because only IE supports the ActiveXObject command.

Re: trying to call iMacros from javascript

Posted: Mon Mar 30, 2009 7:45 pm
by mknoll1
Am I understanding this correctly that a user must click on a link in IE and a Firefox window will open and run the script? It does not appear that the script itself is actually transferred to the customer in this case. Does this mean the customer must have the script prior to clicking the link?

Re: trying to call iMacros from javascript

Posted: Fri Apr 03, 2009 3:04 pm
by Marcia, Tech Support
Hello,
It does not appear that the script itself is actually transferred to the customer in this case. Does this mean the customer must have the script prior to clicking the link?
In this particular example, it is exactly how you described. However, you can pass the iMacros code in the javascript, by creating a variable which carries the whole code, as in SI-Send-Macro-Code.js.