Open webpage Decrease Progressively in iMacros browser, help pls - imacros

I am new to iMacros and I try to write my first scripts ,here is what I write this script to do:
I just setup a new blog and I check all the post everyday,the page link is in format: web.com/viewnews-98.htm ,I need iMacros to open all the posts one by one with 4 secends interval each start frome page 1 increase progressively or from 98 decrease progressively ,I can only write the below part of the scripts, pls show me how to make my first script runing as my wish.
Thanks !
Here is my code:
VERSION BUILD=9002379
TAB T=1
TAB CLOSEALLOTHERS
SET !VAR1 98
ADD !VAR1 -1
URL GOTO=www.web.com/viewnews-{{!VAR1}}.html

try this running it with loop
VERSION BUILD=9002379
TAB T=1
TAB CLOSEALLOTHERS
SET !VAR1 98
ADD !VAR1 -{{!loop}}
URL GOTO=http://www.web.com/viewnews-{{!VAR1}}.html

Related

Imacros add a part to the URL

I'm trying to make a Imacro script to download multiple photos from Unsplash because I have a project and it's time consuming to download one by one.
So far, I've managed to make the following code. But it skips many images.
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:https://unsplash.com/photos/*/download?force=true
Then I found out that the problem is Unsplash doesn't have download?force=true for all images.
Now, what I want is, let it add + download?force=true part after the URL automatically.
To clarify more, this is what I want.
https://unsplash.com/photos/*/ + download?force=true
Thanks in advance.
This should be good enough, I would think:
TAG POS={{!LOOP}} TYPE=A ATTR=HREF:https://unsplash.com/photos/*/*
Only keep the parts that are always there and replace the parts that might be changing or might not be there with *, like you were already doing in /photos/*/....

iMacros TAG CONTENT doesn't works

I want to put text into the input on the page, but it doesn't belong to any valid form. How I can do it?
I tried:
TAG SELECTOR='<selector>' CONTENT='<content>'
and
EVENT TYPE=KEYPRESS SELECTOR="selector" KEYS=[keycodes]
But it doesn't seem to work
First of all,
CSS Selectors are only available in EVENT command with imacros add-on for firefox. But one need iMacros pro v11 to use CSS Selectors in TAG command.
So why cant you just do this
First, use imacros plugin in firefox for this, then go to Record -> Record Options -> Enable Experimental Event Recording Mode.
Then click record button and click the input box where you want to paste, the selector for the input tag will be recorded like so.
EVENT TYPE=MOUSEDOWN SELECTOR="html>body>div:nth-of-type(2)>div:nth-of-type(2)>input" BUTTON=0
Now what you actually need is only the selector address, this will be the path of the input tag where you want to place your text. So next you will paste the selector from the previous step into the below code.
SET !CLIPBOARD "text that is going to be placed in the input tag"
EVENT TYPE=KEYPRESS SELECTOR="html>body>div:nth-of-type(2)>div:nth-of-type(2)>input" CHAR="v" MODIFIERS="ctrl"
So lets check the above code on what is going on.
Line1: We set the clipboard variable of imacros to whatever text you want to insert.
Line2: Then the event tag is going to select the input tag will the selector that we manually inserted, Then we trigger a Ctrl + v through Imacros and the text is gonna get pasted.
I hope my explanation was clear and consise and hope it helped with your issue.
References:
How to select all copy and paste in imacros
How to extract text using CSS Selectors
imacros selector discussion

Submit form with iMacros

I know this might seem a lazy question, but I did not find a straight to the point answer yet.
When I type "submit form with imacros" on Google, nothing is clear to me.
And the official iMacros documentation talks about filling forms, but not about submitting them.
I saw that some examples use javascript:
URL GOTO=javascript:window.document.form.submit();
Other examples use CLICK with coordinates.
So, how do you submit forms with iMacros?
The most basic way to submit a form is via the submit button supplied at the page.
The easiest way to do so is to record clicking on it (FireFox iMacro addon -> Record tab -> Record , play with record options only if needed). The output will be saved under #Current.iim and will look like this:
VERSION BUILD=8970419 RECORDER=FX
TAB T=1
URL GOTO=http://demo.imacros.net/Automate/TestForm1
TAG POS=1 TYPE=BUTTON FORM=ACTION:/Automate/FormSubmitConfirm ATTR=TXT:Click<SP>to<SP>order<SP>now
iMacro will use attributes like html type, form action and the text on the button to identify it against others. Once recorded you can start messing around with attributes if you have additional needs.
Solutions like CLICK or javascript have a tendency to almost never work (for me personally) and are used in more extreme cases where the buttons change names/ids/locations in an unpredictable way.
If you want to press enter to submit then you can do this this works in CHROME imacros for me ..
EVENT TYPE=KEYPRESS SELECTOR="#react-root>SECTION>MAIN>DIV>DIV>ARTICLE>DIV:nth-of-type(2)>SECTION:nth-of-type(3)>FORM>TEXTAREA" CHAR="\r"

Imacro script for dynamic link

is there anyway to make imacro to click this link ? it's dynamic link. so everytime "id=33" will be change.
<span itemprop="name">
<h2>link</h2>
</span>
Preview = http://elakirihub.xyz/new.php
Thanks
Use * character as a wildcard when the last part of the link changes.
Working Example for your case:
TAG POS=1 TYPE=A ATTR=HREF:/story.php?id=*
Since you did not state the environment my example is for iMacros Browser plugin, but the fundamentals apply for iMacros in general.
If you are unsure how to generate the full code before the addition of wildcards you can experiment with recordings or go to the iMacros wiki:
wiki.imacros.net/

Different behavior when executing same IIM macro from "iMacros Component for .net" and when executing in iMacros editor/browser

I'm executing the following macro from inside VB.net using the iMacros component for .NET
VERSION BUILD=10.4.28.1074
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6900914
SET !WAITPAGECOMPLETE YES
WAIT SECONDS=10
TAG POS=1 TYPE=H1 ATTR=* EXTRACT=TXT
This retrieves the name of the manuscript from IEEE Xplore. This works perfectly from inside the iMacros browser/editor. But, when executing the script from inside Vb.net, it gives me a "#EANF#" (Extraction Anchor Not Found).
I'm confounded.
I found the problem.
The difference in behavior was because the site (here, IEEE Xplore), does not allow browsing from old browsers. Now, the iMacro browser works under IE 7's name. All you need to do is to add your program to the "browser emulation list", thus morphing your iMacros component browser to "look" like a newer browser for those websites that need it.
You'll find all the details on how to do that here:
How do I turn off Compatibility View on the IE WebBrowserControl in a WinForms app?