I am using the concept of imacro to auto fill a form. I have recorded one and got the script.
For eg:-
VERSION BUILD=7601105 RECORDER=FX
TAB T=1
URL GOTO=http://mysite/home.aspx
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:home.aspx ATTR=ID:ContentPlaceHolder1_txtUsername CONTENT=samual
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:home.aspx ATTR=ID:ContentPlaceHolder1_txtPassword CONTENT=sampassword
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:ContentPlaceHolder1_btnLogin
TAG POS=1 TYPE=A ATTR=ID:ContentPlaceHolder1_bpo_TabContainer_tbpnl_lnk_address_0
TAG POS=1 TYPE=INPUT:IMAGE FORM=ID:form1 ATTR=ID:Logout
But my actual requirement is on a button click I need to call this macro and each time the form field value may changes. So I need to dynamically pass these new values to the macros. I am thinking like clicking on that button I will pass new value to these script and save this macro and call that macro. But I am not sure is this the way it will work or is it possible to call a macro (like above) from a program that is created using imacro?
Thanks
Thanks a lot for the answer . It gave some insight. But can you explain a bit more. Because I am completely new to the imacro concept.
<html>
<body>
<script type="text/javascript">
function runimacros() {
var iim1 = new ActiveXObject("imacros");
var ret
ret = iim1.iimInit("-fx");
ret = iim1.iimDisplay("Test Macro");
ret = iim1.iimPlay ("testmacro.iim");//this is the macro which I created in firefox and located C:\Users\MyName\Documents\iMacros\Macros\testmacro.iim
ret = iim1.iimExit();
}
</script>
<a href="javascript:runimacros()">Click to run iMacros</font></a>
</body>
</html>
Please note that the macro which created(testmacro.iim) is using firefox and it is located in the above location.
I tried the approach 'http://wiki.imacros.net/JavaScript' but is not working. Am I missing something? I tried the above code in Visual studio and made the default browser as IE. Please give any suggestion.
Thanks
You can't call an Imacros program (.iim) from another one, but you can use javascript to call one or more iim files passing one variable:
var ret;
ret = iimDisplay ("optional message to be displayed on the Imacros banner");
var i='input variable'
ret = iimSet("i", i);
ret = iimPlay("myScript.iim");
/* Check for error */
if (ret = 1) {
/* do useful stuff */
}else
{
err = "The following error occurred: "+iimGetLastError();
alert(err);
};
In the macros script:
'this way we pass the variable to the input field
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:ContentPlaceHolder1_txtUsername CONTENT={{i}}