Dynamic Frame Tracking

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.

Re: Dynamic Frame Tracking

by azbob on Wed Jun 14, 2017 6:24 pm

FYI here is my final copy of the Frame Tracker...
Code: Select all
iimPlay('++AATEST_PRE_LOOP.iim');
//declarations
var fnb=(14);

var find_number =  "CODE:";
find_number += "SET !ERRORIGNORE YES" + "\n";
find_number += "SET !EXTRACT NULL" + "\n";
find_number +=  "FRAME F={{Frame_Nb}}" + "\n";
find_number +=  "SET !TIMEOUT_STEP 0" + "\n";
find_number +=  "TAG POS=1 TYPE=TD ATTR=TXT:High" + "\n";
find_number +=  "TAG POS=R1 TYPE=TD ATTR=ID:hiLP EXTRACT=TXT" + "\n";

for(; fnb <= 18; fnb++){
   iimSet("Frame_Nb",fnb);
   iimPlay(find_number);
   var frame_valid = iimGetLastExtract(1);


//if extract was frame number than save frame number and play rest of macro
   if (frame_valid !== "#EANF#")
        {
   iimSet("Frame_Nb",fnb);
   break;
   }
   
   }
iimPlay('++AATEST_POST_LOOP.iim');

Thanks for all your help...
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by chivracq on Wed Jun 14, 2017 9:47 pm

azbob wrote:Here is link to files.

https://www.dropbox.com/sh/xjdshdwxrqpm ... K2yCa?dl=0

I hope I created them correctly.
Let me know if you need anything else.
Thanks,
Bob

OK, was a bit of a hassle as one single Zip File would have been easier and I feared for a while I would need to download one by one the 278 Files (278...!?, for 1 Web-Page...!?, WTF...!?) but DropBox via FF53 managed to zip everything by itself...

But pfff..., once opened and a bit analyzed, this Site is so ridiculously bad designed with 4 Levels of Nested Frames that the Method I had in mind (which would work for 1 Level) would quickly become very cumbersome I fear and would then take much longer than your Method with a '.js' Loop.
And yep..., they all do have an ID/Name, but the same ID is reused at different Nested Levels, so iMacros cannot use it as it doesn't have a 'POS' Parameter for the 'FRAME' Command like it has for the 'TAG' Command. I'm actually nearly a bit surprised that iMacros is still able to locate all those Frames by their Number without being mixed up...! 8)

The only "good Design" of this Site is the Size of the Pictures, 51 Pictures = only 1.3Mb (=> about 25Kb per Picture, which is very neat), but the whole Page is 8Mb heavy, which is a bit ridiculous...!, I hope you are not on Mobile with a limited Data Amount, ah-ah...! But the Site didn't looked designed for Mobile anyway, the Frames would lose track constantly of my Screen Size and overlap each other after each iMacros Panel Open/Close Toggle...

azbob wrote:FYI here is my final copy of the Frame Tracker...
Code: Select all
iimPlay('++AATEST_PRE_LOOP.iim');
//declarations
var fnb=(14);

var find_number =  "CODE:";
find_number += "SET !ERRORIGNORE YES" + "\n";
find_number += "SET !EXTRACT NULL" + "\n";
find_number +=  "FRAME F={{Frame_Nb}}" + "\n";
find_number +=  "SET !TIMEOUT_STEP 0" + "\n";
find_number +=  "TAG POS=1 TYPE=TD ATTR=TXT:High" + "\n";
find_number +=  "TAG POS=R1 TYPE=TD ATTR=ID:hiLP EXTRACT=TXT" + "\n";

for(; fnb <= 18; fnb++){
   iimSet("Frame_Nb",fnb);
   iimPlay(find_number);
   var frame_valid = iimGetLastExtract(1);


//if extract was frame number than save frame number and play rest of macro
   if (frame_valid !== "#EANF#")
        {
   iimSet("Frame_Nb",fnb);
   break;
   }
   
   }
iimPlay('++AATEST_POST_LOOP.iim');

Thanks for all your help...

Yep, glad I could help... :D
A few little "things" could still be improved in your Script but "we" won't touch anything as it works now, I'm afraid you might start a new "Challenge" otherwise, ah-ah...! :shock: :wink:

(Now you can share your Sol on SOF as well, and you could mention your FCI there as well... :idea:
And hum, @Shugar's Suggestion is correct in general but doesn't play a role in your Case as the 3 Vars you define in your '.js' Script with 'iimSet()' are not used in your 'find_number' on-the-fly Macro and we can't tell if you use them or not in your '++AATEST_POST_LOOP.iim' Macro, so moving them won't change anything...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Dynamic Frame Tracking

by azbob on Thu Jun 15, 2017 5:19 pm

Well most of those iimSets were just for testing as I would pass into post loop than prompt for result..so yea not important.

Here is a follow on question. I am now integrating find_number into existing macros by creating .js files that call .iim files. Following the format of iimPlay(x.iim), run find_number .js, passing Frame_Nb to next iimPlay(y.iim).
In this instance imacros file named A_SVS_TAX_DATA.js.
In first x.iim in file I have a prompt for address that I store in !VAR1 that I want to access in y.iim to pass to a web page.
So what I tried to do was create a csv file in x.iim:
Code: Select all
PROMPT "Please enter subject street address:" !VAR1
PROMPT "Enter subject zip code:" !VAR2
PROMPT "Enter subject city" !VAR7
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
'*******Create csv file woth address in COL1*************
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv

with !VAR1 in COL1, then accessing csv in y.iim:
Code: Select all
 
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
'************************
FRAME F={{FRAME_Nb}}
'******Avg SQFT***************
TAG POS=8 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg LP***************
TAG POS=9 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg LP/sqft***************
TAG POS=11 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg SP***************
TAG POS=10 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg SP/sqft***************
TAG POS=12 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'***Sold/Original List price ratio*******
TAG POS=14 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'***********DOM/ADOM/CDOM*********
TAG POS=1 TYPE=DIV ATTR=CLASS:center EXTRACT=TXT
'Overwrite old data
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\CMATaxdata\CMA.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\CMATaxdata FILE=CMA.csv
FRAME NAME=top_frame
'New tab opened open Tax data
TAG POS=1 TYPE=DIV ATTR=ID:taxes_sidemenuheader
TAG POS=2 TYPE=A ATTR=TXT:Monsoon
'New tab opened
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:searchQuery [b]CONTENT={{address}}[/b]

But when I run "A_SVS_TAX_DATA.js" it ignores and jumps over x.iim and starts to execute find_number script. It does not throw an error, but it obviously doesn't like the "creating csv file" bits, cause if I take it out, "A_SVS_TAX_DATA.js" file runs as usual although I'm not able to access !VAR1 as I want to.
Any ideas?
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by chivracq on Thu Jun 15, 2017 8:05 pm

azbob wrote:Well most of those iimSets were just for testing as I would pass into post loop than prompt for result..so yea not important.

Here is a follow on question. I am now integrating find_number into existing macros by creating .js files that call .iim files. Following the format of iimPlay(x.iim), run find_number .js, passing Frame_Nb to next iimPlay(y.iim).
In this instance imacros file named A_SVS_TAX_DATA.js.
In first x.iim in file I have a prompt for address that I store in !VAR1 that I want to access in y.iim to pass to a web page.
So what I tried to do was create a csv file in x.iim:
Code: Select all
PROMPT "Please enter subject street address:" !VAR1
PROMPT "Enter subject zip code:" !VAR2
PROMPT "Enter subject city" !VAR7
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
'*******Create csv file woth address in COL1*************
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv

with !VAR1 in COL1, then accessing csv in y.iim:
Code: Select all
 
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
'************************
FRAME F={{FRAME_Nb}}
'******Avg SQFT***************
TAG POS=8 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg LP***************
TAG POS=9 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg LP/sqft***************
TAG POS=11 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg SP***************
TAG POS=10 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'******Avg SP/sqft***************
TAG POS=12 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'***Sold/Original List price ratio*******
TAG POS=14 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT
'***********DOM/ADOM/CDOM*********
TAG POS=1 TYPE=DIV ATTR=CLASS:center EXTRACT=TXT
'Overwrite old data
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\CMATaxdata\CMA.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\CMATaxdata FILE=CMA.csv
FRAME NAME=top_frame
'New tab opened open Tax data
TAG POS=1 TYPE=DIV ATTR=ID:taxes_sidemenuheader
TAG POS=2 TYPE=A ATTR=TXT:Monsoon
'New tab opened
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:searchQuery [b]CONTENT={{address}}[/b]

But when I run "A_SVS_TAX_DATA.js" it ignores and jumps over x.iim and starts to execute find_number script. It does not throw an error, but it obviously doesn't like the "creating csv file" bits, cause if I take it out, "A_SVS_TAX_DATA.js" file runs as usual although I'm not able to access !VAR1 as I want to.
Any ideas?

Oh... yeah...!, looks like a new Challenge. pfff, I thought your Thread was solved...!?, just back from some "heavy" (Musical) Evening now (I'm an Artist/Musician/DJ IRL...), I'll have a look "tomorrow" after some "Sleep", ah-ah...!
Last edited by chivracq on Fri Jun 16, 2017 10:36 am, edited 1 time in total.
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Dynamic Frame Tracking

by azbob on Thu Jun 15, 2017 10:32 pm

Okay
Thanks..
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by azbob on Fri Jun 16, 2017 8:58 am

BTW: Attempts:
SAVE AS: long shot, but NG threw: wrong format of SAVEAS command, line 28 (Error code: -910)
iimSet("Address",address) in .iim's:but threw:can not parse macro line: iimSet("address",{{!VAR1}}) (Error code: -910)
Maybe I have looked at this too long....
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by chivracq on Fri Jun 16, 2017 10:54 am

azbob wrote:BTW: Attempts:
SAVE AS: long shot, but NG threw: wrong format of SAVEAS command, line 28 (Error code: -910)
iimSet("Address",address) in .iim's:but threw:can not parse macro line: iimSet("address",{{!VAR1}}) (Error code: -910)
Maybe I have looked at this too long....

I didn't understand "NG"...

- Hum, you may need to escape (=double) the Backslashes for 'FILEDELETE' and 'SAVEAS'.
- You may want to add an '!ERRORIGNORE' around the 'FILEDELETE'... which will fail the next time you want to run this Macro if the File already got deleted (from some previous Run)...
- You are using '!VAR7' for a 'PROMPT' while according to the Wiki, you can only use '!VAR1'-'!VAR3' for an Input 'PROMPT'...
- Check the ReturnCode on 'x.iim' and use 'iimGetErrorText()' to debug that Script...

Code: Select all
iimSet("Address",address) in .iim's:but threw:can not parse macro line: iimSet("address",{{!VAR1}}) (Error code: -910)

=> Yeah, you cannot use '!VAR1', I think, in a '.js' Script, you need to use '!EXTRACT' and 'iimGetExtract()' to pass a Var from an '.iim' to a '.js' Script...
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Dynamic Frame Tracking

by azbob on Fri Jun 16, 2017 12:32 pm

NG=no good
Oh interesting about !VAR7...must get by okay as have been using that macro for months with no problems.
Just to be clear here is the code of JS file "A_SVS_TAX_DATA.js":
Code: Select all
//Stewart Valuations SFD JS_IMACRO 6/14/2017

iimPlay('++SFD_Stewart_Valuations_STEP_1.iim');
//declarations
var fnb=(14);

var find_number =  "CODE:";
   find_number += "SET !ERRORIGNORE YES" + "\n";
   find_number += "SET !EXTRACT NULL" + "\n";
   find_number +=  "FRAME F={{Frame_Nb}}" + "\n";
   find_number +=  "SET !TIMEOUT_STEP 0" + "\n";
   find_number +=  "TAG POS=8 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT" + "\n";
   

   for(; fnb <= 18; fnb++){
      iimSet("Frame_Nb",fnb);
      iimPlay(find_number);
      var frame_valid = iimGetLastExtract(1);
   

//if extract was frame number than save frame number and play rest of macro
   if (frame_valid !== "#EANF#")
        {
      iimSet("Frame_Nb",fnb);
      var Frame_Nb=fnb;
      break;
   }
   
   }
iimPlay('++SFD_Stewart_Valuations_STEP_2.iim');

So this code is in "iimPlay('++SFD_Stewart_Valuations_STEP_1.iim')
Code: Select all
PROMPT "Please enter subject street address:" !VAR1
PROMPT "Enter subject zip code:" !VAR2
PROMPT "Enter subject city" !VAR7
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
'*******Create csv file with address in COL1*************
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv

and then I want to access Address.csv to use contents of !COL1 with this code that is in iimPlay('++SFD_Stewart_Valuations_STEP_2.iim');:
Code: Select all
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
SET address {{!COL1}}
'>
'>
Set
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:searchQuery [b]CONTENT={{address}}[/b]
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by azbob on Sat Jun 17, 2017 8:22 pm

Okay thanks to your help and correcting a few typos, I got it running.
This code goes in .iim macro 1:
Code: Select all
'
PROMPT "Please enter subject street address:" Sub_address
PROMPT "Enter subject city" Sub_city
PROMPT "Enter subject zip code:" Sub_zip
'
'**********STORE SUBJECT ADDRESS IN CSV FILE SO FOLLOWING MACROS CAN ACCESS**********************
SET !EXTRACT NULL
ADD !EXTRACT {{Sub_address}}
ADD !EXTRACT {{Sub_city}}
ADD !EXTRACT {{Sub_zip}}
'
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata FILE=Address.csv

Then this code goes in .iim macro 2
Code: Select all
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
SET Sub_address {{!COL1}}
SET Sub_city {{!COL2}}
SET Sub_zip {{!COL3}}
'************************


All is well the .js active frame finder .js bit goes at ludicrous speed compared to the other method.
Alas I couldn't have got to this one without the other so all is good.
Thanks again...
BTW: You probably know this, when splitting a larger macro into separate parts interspersed with .js files, the TAB reference flow gets severed.
azbob
 
Posts: 67
Joined: Mon Sep 21, 2009 11:16 am

Re: Dynamic Frame Tracking

by chivracq on Sun Jun 18, 2017 7:51 am

azbob wrote:NG=no good
Oh interesting about !VAR7...must get by okay as have been using that macro for months with no problems.
Just to be clear here is the code of JS file "A_SVS_TAX_DATA.js":
Code: Select all
//Stewart Valuations SFD JS_IMACRO 6/14/2017

iimPlay('++SFD_Stewart_Valuations_STEP_1.iim');
//declarations
var fnb=(14);

var find_number =  "CODE:";
   find_number += "SET !ERRORIGNORE YES" + "\n";
   find_number += "SET !EXTRACT NULL" + "\n";
   find_number +=  "FRAME F={{Frame_Nb}}" + "\n";
   find_number +=  "SET !TIMEOUT_STEP 0" + "\n";
   find_number +=  "TAG POS=8 TYPE=TD ATTR=CLASS:compareTd EXTRACT=TXT" + "\n";
   

   for(; fnb <= 18; fnb++){
      iimSet("Frame_Nb",fnb);
      iimPlay(find_number);
      var frame_valid = iimGetLastExtract(1);
   

//if extract was frame number than save frame number and play rest of macro
   if (frame_valid !== "#EANF#")
        {
      iimSet("Frame_Nb",fnb);
      var Frame_Nb=fnb;
      break;
   }
   
   }
iimPlay('++SFD_Stewart_Valuations_STEP_2.iim');

So this code is in "iimPlay('++SFD_Stewart_Valuations_STEP_1.iim')
Code: Select all
PROMPT "Please enter subject street address:" !VAR1
PROMPT "Enter subject zip code:" !VAR2
PROMPT "Enter subject city" !VAR7
SET !EXTRACT NULL
ADD !EXTRACT {{!VAR1}}
'*******Create csv file with address in COL1*************
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv

and then I want to access Address.csv to use contents of !COL1 with this code that is in iimPlay('++SFD_Stewart_Valuations_STEP_2.iim');:
Code: Select all
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
SET address {{!COL1}}
'>
'>
Set
TAG POS=1 TYPE=INPUT:TEXT ATTR=NAME:searchQuery [b]CONTENT={{address}}[/b]

Ah, OK for "NG"...

OK..., was waiting for you to apply any of my "Suggestions"...

azbob wrote:Okay thanks to your help and correcting a few typos, I got it running.
This code goes in .iim macro 1:
Code: Select all
'
PROMPT "Please enter subject street address:" Sub_address
PROMPT "Enter subject city" Sub_city
PROMPT "Enter subject zip code:" Sub_zip
'
'**********STORE SUBJECT ADDRESS IN CSV FILE SO FOLLOWING MACROS CAN ACCESS**********************
SET !EXTRACT NULL
ADD !EXTRACT {{Sub_address}}
ADD !EXTRACT {{Sub_city}}
ADD !EXTRACT {{Sub_zip}}
'
FILEDELETE NAME=C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SAVEAS TYPE=EXTRACT FOLDER=C:\Users\Public\Documents\iMacros\datasources\BBformdata FILE=Address.csv

Then this code goes in .iim macro 2
Code: Select all
'****************open datasouce****************
SET !DATASOURCE C:\Users\Public\Documents\iMacros\datasources\BBformdata\Address.csv
SET !DATASOURCE_LINE 1
SET Sub_address {{!COL1}}
SET Sub_city {{!COL2}}
SET Sub_zip {{!COL3}}
'************************


All is well the .js active frame finder .js bit goes at ludicrous speed compared to the other method.
Alas I couldn't have got to this one without the other so all is good.
Thanks again...
BTW: You probably know this, when splitting a larger macro into separate parts interspersed with .js files, the TAB reference flow gets severed.

OK, good-good...!

Oh...!, "Lesson" for me, ah-ah...!, apart from '!VAR7' for an Input 'PROMPT' in one of my previous Replies, you can even use 'User-defined' Vars...!?, OK, didn't know that... Well, I never needed more than 1 Var for the very few (Confirmation) Input 'PROMPT's that I use in my own Macros, so I always used '!VAR1' without "experimenting" that much with 'PROMPT', hum..., except in this Thread, ah-ah...!
And I try to avoid (Input) 'PROMPT's in my own Macros, I usually always go for "Full" Automation without any User Interaction, if User Input is "needed", my Scripts are normally more "clever" than me, ah-ah...!, and I think it's always possible to model/compute/generate that Input from the Script itself... I only use 'PROMPT' for Debug Purpose actually...

Hum..., Double Backslashes are not needed then for Paths, I see from your Scripts...

Well, about iMacros losing track of the Tab Sequence, I didn't "really" know because I don't use any '.js' Scripts, but..., tja..., I'm not surprised, it's the same with '.iim' Macros (I have some '.iim's calling another '.iim' in chain), a Script needs a "TAB T=1" at its beginning to know from which Tab it is starting if the Tab Sequence is "important" for the Workflow of your (overall) Script...

Mini-Caveat I foresee in your whole Workflow is the 'FILEDELETE', I mentioned earlier using '!ERRORIGNORE' for it but you didn't follow my Sugg, and I'm not even sure that "would be enough" as your 'iim' Macro will run from the '.js' Script and won't abort if "anything" goes wrong, but the 'FILEDELETE' might fail if for example you have the '.CSV' opened in Excel, then I'm not completely sure about what will happen with the 'SAVEAS', if it will fail as well or if the Data will get appended to the existing File that could not get deleted or if a new File will be created with "(1)" in its Name, but in both cases, your next Macro will reuse the previous Data from Row_1 from your existing File... Oops...! :(
=> You might want to separate that part from its current Macro and check for the RetCode on some mini-Macro doing only the 'FILEDELETE' (and it's possible to add some extra check by "misusing" the '!FOLDER_DATASOURCE' Command which is able to find out if a specific Folder or File does exist (or doesn't exist anymore after the Delete, ah-ah..!))...

Another Method that I use is to include a Timestamp in your 'SAVEAS' and have your 2nd Macro check this Timestamp to decide that if the Data is "older" than 5 min for example, then stg went "wrong" in the whole Process... :idea:
I use 'STOPWATCH' as well to check if a Macro completed in some "reasonable" amount of time, to eventually decide if it needs to run again, but that might be a bit of a hassle in your case as you'll need to have the 3 Macros to "communicate" with each other..., the 'Timestamp' Method will probably be easier... Oh yeah...!, I guess this will be your next "Challenge", ah-ah...! :shock:
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Previous

Return to Data Extraction and Web Screen Scraping

Who is online

Users browsing this forum: chivracq and 3 guests

Website Monitoring