Variable POS TAG in Loop

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Variable POS TAG in Loop

by chrisko on Thu Mar 10, 2016 2:08 pm

MY CONFIG:
iMacros 8.9.6 for Firefox
Firefox 45.0
Mac OSX 10.10.5

Code: Select all
TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:

TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS=38 TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:


I have that variable TAG POS in
Code: Select all
TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen


and want to build a loop. i dont know how i can solve that.
Last edited by chrisko on Thu Mar 10, 2016 3:55 pm, edited 2 times in total.
MY Config: iMacros 8.9.6 for Firefox; Firefox 45.0; Mac OSX 10.10.5
chrisko
 
Posts: 21
Joined: Fri Mar 04, 2016 6:08 pm

Re: Variable POS TAG in Loop

by chivracq on Thu Mar 10, 2016 3:15 pm

chrisko wrote:
Code: Select all
TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:

TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
TAG POS=38 TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:


I have that variable TAG POS in
Code: Select all
TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen


and want to build a loop. i dont know how i can solve that.

Pfff..., no Comment...! :roll:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Variable POS TAG in Loop

by chrisko on Thu Mar 10, 2016 3:21 pm

chivracq wrote:Pfff..., no Comment...! :roll:


hmm... thats not really helpfull. :(

Please excuse my ignorance.
MY Config: iMacros 8.9.6 for Firefox; Firefox 45.0; Mac OSX 10.10.5
chrisko
 
Posts: 21
Joined: Fri Mar 04, 2016 6:08 pm

Re: Variable POS TAG in Loop

by chivracq on Thu Mar 10, 2016 3:40 pm

chrisko wrote:
chivracq wrote:Pfff..., no Comment...! :roll:


hmm... thats not really helpfull. :(

Please excuse my ignorance.

Yep, sorry, I get tired after asking you half a dozen times to mention your FCI when you open a Thread, you don't want to play the game, I'm out...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Variable POS TAG in Loop

by chrisko on Thu Mar 10, 2016 3:46 pm

chivracq wrote:...you don't want to play the game, I'm out...


ohh that game... f**ck. sorry im tired. forget that again. but i vow improvement ;-)

I'll update my main post...

...and in my Signature, so i cant forgett :wink:
MY Config: iMacros 8.9.6 for Firefox; Firefox 45.0; Mac OSX 10.10.5
chrisko
 
Posts: 21
Joined: Fri Mar 04, 2016 6:08 pm

Re: Variable POS TAG in Loop

by chivracq on Thu Mar 10, 2016 4:13 pm

chrisko wrote:
chivracq wrote:...you don't want to play the game, I'm out...


ohh that game... f**ck. sorry im tired. forget that again. but i vow improvement ;-)

I'll update my main post...

...and in my Signature, so i cant forgett :wink:

Well, fair enough, but don't be surprised next time if you forget again if I don't react to a new Thread of yours...

And mentioning your FCI in your Sig denotes from a good Intention, but it doesn't "free" you from hard-coding it in your OP as you only have one Dynamic Sig for the whole Forum, so it only gives an Indication of your Current FCI..., which will probably change in a few weeks/months/years, and somebody reading some older Thread a few weeks/months/years later will be completely confused from seeing that you were using iMacros v20 with FF150 on Win69 in March 2016...!

But OK, your Current Qt, that I finally read is as simple as 1+1=...?, honestly, I'm not kidding...!

I give you a few more minutes to find it by yourself, I'm online, you will get your Solution before you go to bed, I promise, but honestly a child of 4 would solve it... (And I'm correct that your Series goes 36 => 38 => 40 => 42 => etc..., with 36 at Loop=1...?)

Oh, and you are the second User reporting using FF45, cross all the fingers you have, nearly all FF Versions since FF29 have broken stg in iMacros for FF, Current Version (v8.9.6) was "designed" for FF43, and works/worked fine in FF44 as well, maybe/hopefully will work as well in FF45...!?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Variable POS TAG in Loop

by chrisko on Thu Mar 10, 2016 5:23 pm

chivracq wrote:
And mentioning your FCI in your Sig denotes from a good Intention, but it doesn't "free" you from hard-coding it in your OP as you only have one Dynamic Sig for the whole Forum, so it only gives an Indication of your Current FCI..., which will probably change in a few weeks/months/years, and somebody reading some older Thread a few weeks/months/years later will be completely confused from seeing that you were using iMacros v20 with FF150 on Win69 in March 2016...!


ok, again ur right!


chivracq wrote:But OK, your Current Qt, that I finally read is as simple as 1+1=...?, honestly, I'm not kidding...!

I give you a few more minutes to find it by yourself, I'm online, you will get your Solution before you go to bed, I promise, but honestly a child of 4 would solve it... (And I'm correct that your Series goes 36 => 38 => 40 => 42 => etc..., with 36 at Loop=1...?)


hmm... jepp... works... THX!

Code: Select all
var macro;
macro =  "CODE:";
macro +=  "TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen" + "\n";
macro +=  "ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES" + "\n";
macro +=  "TAG POS={{i}} TYPE=SPAN ATTR=TXT:Herunterladen" + "\n";
macro +=  "CLICK X=653 Y=376" + "\n";
for(i=2;i<=500;i=i+2){
iimSet("i",i);
iimPlay(macro);
}
}
MY Config: iMacros 8.9.6 for Firefox; Firefox 45.0; Mac OSX 10.10.5
chrisko
 
Posts: 21
Joined: Fri Mar 04, 2016 6:08 pm

Re: Variable POS TAG in Loop

by chivracq on Thu Mar 10, 2016 6:03 pm

chrisko wrote:
chivracq wrote:But OK, your Current Qt, that I finally read is as simple as 1+1=...?, honestly, I'm not kidding...!

I give you a few more minutes to find it by yourself, I'm online, you will get your Solution before you go to bed, I promise, but honestly a child of 4 would solve it... (And I'm correct that your Series goes 36 => 38 => 40 => 42 => etc..., with 36 at Loop=1...?)


hmm... if its always +2 should work...but ...hmmm not really...maybe wrong code ?

Code: Select all
var macro;
macro =  "CODE:";
macro +=  "TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen" + "\n";
macro +=  "ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES" + "\n";
macro +=  "TAG POS={{i}} TYPE=SPAN ATTR=TXT:Herunterladen" + "\n";
macro +=  "TAG POS=55 TYPE=I ATTR=TXT:" + "\n";
for(i=38;i<=60;i=i+2){
iimSet("i",i);
iimPlay(macro);
}

Ah OK, I thought you had already gone to bed and were currently dealing with the Monster with 11 Eyes...!
But Nope...! You were concocting some looking good though cumbersome on the fly generated Macro, I'm impressed...!

In pure '.iim', using your original '.iim' Macro, a simple Solution would be:
Code: Select all
SET !LOOP 1
SET Init_POS 34
SET Current_POS {{Init_POS}}
'1+1=...!?:
ADD Current_POS {{!LOOP}}
ADD Current_POS {{!LOOP}}

TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
'TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen // (Recorded)
TAG POS={{Current_POS}} TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:
(Not tested obviously...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6474
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Variable POS TAG in Loop

by chrisko on Thu Mar 10, 2016 6:24 pm

chivracq wrote:Ah OK, I thought you had already gone to bed and were currently dealing with the Monster with 11 Eyes...!
But Nope...! You were concocting some looking good though cumbersome on the fly generated Macro, I'm impressed...!

Ohh.. das Ärzte Video kann ich auf Youtube leider nicht spielen...Damn...But i ilke! No, not sleeping, had to solve a few other Problems in between ;-)

chivracq wrote:In pure '.iim', using your original '.iim' Macro, a simple Solution would be:
Code: Select all
SET !LOOP 1
SET Init_POS 34
SET Current_POS {{Init_POS}}
'1+1=...!?:
ADD Current_POS {{!LOOP}}
ADD Current_POS {{!LOOP}}

TAG POS=1 TYPE=SPAN ATTR=TXT:Optionen
ONDOWNLOAD FOLDER=* FILE=+_{{!NOW:yyyymmdd_hhnnss}} WAIT=YES
'TAG POS=36 TYPE=SPAN ATTR=TXT:Herunterladen // (Recorded)
TAG POS={{Current_POS}} TYPE=SPAN ATTR=TXT:Herunterladen
TAG POS=55 TYPE=I ATTR=TXT:
(Not tested obviously...)


For the next Step i want to refresh & update my few javascript skills from school and build a scheduled form filling macro.

Again a question regarding the main Topic. How can i solve it if the "POS=55" is really variable and gets random IDS? The thing with "Targeting" the Elements for Clicking, Fulfilling, Extracting e.g. with iMacro is still not really clear for me. There is XPATH, TAG POS= ATTR=, EVENT, CLICK ....a lot of possibilites...


https://www.youtube.com/watch?v=bclgYfhREIg
MY Config: iMacros 8.9.6 for Firefox; Firefox 45.0; Mac OSX 10.10.5
chrisko
 
Posts: 21
Joined: Fri Mar 04, 2016 6:08 pm


Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: No registered users and 6 guests

-->