trying to call iMacros from javascript

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
gavicus
Posts: 1
Joined: Fri Mar 27, 2009 4:41 pm

trying to call iMacros from javascript

Post by gavicus » Fri Mar 27, 2009 4:47 pm

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>
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: trying to call iMacros from javascript

Post by Marcia, Tech Support » Mon Mar 30, 2009 3:56 pm

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.
Regards,

Marcia
mknoll1
Posts: 174
Joined: Fri Dec 23, 2005 4:14 pm

Re: trying to call iMacros from javascript

Post by mknoll1 » Mon Mar 30, 2009 7:45 pm

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?
Marcia, Tech Support
Posts: 1094
Joined: Thu Jan 29, 2009 1:10 pm

Re: trying to call iMacros from javascript

Post by Marcia, Tech Support » Fri Apr 03, 2009 3:04 pm

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.
Regards,

Marcia
Post Reply