So I'm going a little nuts here. I haven't used iMacros in a long time (last post on this account was 2011) and I seem to have forgotten a lot. But I had a problem automating some link clicking and I thought, hey that old iMacros extension might work! So here I am.
So my end goal for my script is to click on several hyperlinked downloads (.torrent files) to automate the downloading process for me.
First problem:
The amount of torrents on the page change, depending on what specific page you're looking at. Some pages on the site may have 7 torrents, others have 2.
Luckily the site lists the amount of torrents on a page in a text attribute (literal text is 'Torrents x').
So first, I need to extract the 'x'. Through quite a bit of searching, it seems the best way to do this is using EVAL + javascript to manipulate the extraction. I settled on using substr because I only need the last value for the extraction and the word Torrents is always the same amount of characters. This is what I have so far:
Code: Select all
SET !EXTRACT_TEST_POPUP NO
TAG POS=1 TYPE=LI ATTR=TXT:Torrents:<SP>* EXTRACT=TXT
SET !VAR1 EVAL("'{{!EXTRACT}}'.substr(10,1);")
PROMPT {{!var1}}
--------------------------
My second problem (getting ahead of myself a bit here but better to ask now I guess):
This is the line of code to click on the download links. Basically there are multiple instances of this text on the page, all corresponding to links to different torrents. Each torrent link looks like this:
[DownLoad]
So to find those links and click on them I use:
Code: Select all
TAG POS=1 TYPE=A ATTR=TXT:DownLoad
TAG POS=2 TYPE=A ATTR=TXT:DownLoad
TAG POS=3 TYPE=A ATTR=TXT:DownLoad
etc...
Code: Select all
TAG POS=1 TYPE=A ATTR=TXT:DownLoad
...
TAG POS=23 TYPE=A ATTR=TXT:DownLoad
How would I go about doing that? I understand I can use TAG POS={{!var1}} to find the final DownLoad but I'm not sure how to use that to count up or how to design it so it stops the code after a certain amount.
Hopefully I explained myself clearly enough, if you need anymore information feel free to ask me to clarify. There's probably a much simpler way of doing this but I'm obviously clueless as to what it is.