I have just downloaded iMacros, but it changes the source code when I do a 'SAVEAS', compared to when I manually do a 'file' -> 'saveas' -> 'web page HTML only' in Firefox.
How can I make the iMacros 'saveas' be the same as my manual FF save?
My iMacros code is:
URL GOTO=http://www.??????
SAVEAS TYPE=HTM FOLDER=C:\xampp\htdocs FILE=name.htm
Try to use this workaround:
SET myLink http://www.??????
URL GOTO={{myLink}}
SET S "var doc = window.document; var elt = doc.createElement('a'); elt.id = 'myA'; elt.href = '{{myLink}}'; doc.body.appendChild(elt); undefined;"
URL GOTO=javascript:{{S}}
ONDOWNLOAD FOLDER=C:\xampp\htdocs FILE=name.htm
TAG POS=1 TYPE=A ATTR=HREF:{{myLink}} CONTENT=EVENT:SAVETARGETAS
URL GOTO=javascript:{doc.body.removeChild(doc.getElementById("myA"));undefined;}
Related
I'm entirely new to iMacros, and I'm trying to get iMacros to extract the email address that appears when you click "reply" on ads like these. (Link is "dead"...)
The only thing I have is:
VERSION BUILD=10021450
URL GOTO=https://losangeles.craigslist.org/sfv/res/d/need-extra-money/7027377618.html
TAG POS=1 TYPE=BUTTON ATTR=TXT:reply
I have tried simply using wildcards, which doesn't work.
I found the answer somehow:
TAG POS=1 TYPE=INPUT ATTR=CLASS:anonemail EXTRACT=TXT
I am running an iMacros macro that navigates a web site and saves a page to a file. I'm using a simple script as follow:
URL GOTO=http://myurl.com/
SAVEAS TYPE=HTM FOLDER=* FILE=*
The issue is that the saved HTML page is different than the one I get when saving from Firefox using File -> Save page as... and selecting "Web Page, HTML only". It seems like some processing is done on the page by iMacros I suppose. For instance this line
<meta charset="utf-8" />
becomes
<meta charset="utf-8">
This looks minor but on some occasions I had element that were reversed, hence hiding an issue with a tag wrongly closed. For example, where my page had
</form></div>
it was saved as
</div></form>
by iMacros.
Unfortunately I cannot find any reference of this issue on the iMacros forum. Any ideas?
Work for me.
Before start script create directory d:\reports or other
URL GOTO=http://your_url
'Uncomment for not show popup
'SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=HTML ATTR=CLASS:* EXTRACT=HTM
SAVEAS TYPE=HTM FOLDER=d:\reports FILE=1.html
try this code.
URL GOTO=http://myurl.com/
TAG POS=1 TYPE=HTML ATTR=CLASS:* EXTRACT=HTM
SAVEAS TYPE=HTM FOLDER=* FILE=*
Also a good and easy way to test extracted data is www.jsbin.com
This line was working before but now it doesn't extract the text, I guess this is happening because it is clicking inside the box. This only happen when I use Firefox, using Internet Explorer is ok.
VERSION BUILD=8021970
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:emailForm ATTR=ID:fName&&VALUE:* EXTRACT=TXT
it looks like the value you need is disappear when imacros tries to scrape it, but you can use this code to get email:
URL GOTO=http://www.fakemailgenerator.com/
TAG POS=1 TYPE=span attr=id:cxtEmail EXTRACT=TXT
or you can scrape htm of your tag and parse it to get value attribute
I want i-macro to do something like this:
1 - go to specific url like: http://www.xyz.com
2 - if there is an error in loading the url, then perform this thing
TAG POS=1 TYPE=IMG ATTR=SRC:http://www.xyz.com
3 - else load the page
my question is how can i accomplish this task
Since there is no IF statement in imacros you'll need to use javascript (for example). the code would be like this:
var ret=iimPlay("code:url goto=http://xyz.com");
if (ret<0){
iimPlay("code:TAG POS=1 TYPE=IMG ATTR=SRC:http://www.xyz.com");
}
else{
iimPlay("code:refresh");
}
save it as js file and run in firefox imacros.
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>
Click to run iMacros</font>
</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}}