how to carry TAB memory from one macro to another

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
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.
Post Reply
green.pine
Posts: 62
Joined: Thu Nov 04, 2010 5:21 pm

how to carry TAB memory from one macro to another

Post by green.pine » Sat Sep 30, 2017 11:25 am

Hello;
running FF 55.0.3 on Win 7 32 bit, imacros ver. v8.9.7

I wonder how to pass TAB memory into the another macro script.
I have two macro scripts, (I could not do the task in one macro file),
java script call the first macro, which opens 2 different websites on 2 TABs,
and do some task forth and back on TAB 1 & TAB 2, when done, java script will run the second macro,
the second macro suppose to do some task on same opened tabs,
but second macro does not recognize TABs that have been opened in the first macro .

I want the second macro remember the opened TABs to be able to do some other tasks forth and back on these 2 TABs.

How Can I make it work?
Appreciate your help.
chivracq
Posts: 7970
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: how to carry TAB memory from one macro to another

Post by chivracq » Sat Sep 30, 2017 4:02 pm

green.pine wrote:Hello;
running

Code: Select all

FF 55.0.3 on Win 7 32 bit, imacros ver. v8.9.7
I wonder how to pass TAB memory into the another macro script.
I have two macro scripts, (I could not do the task in one macro file),
java script call the first macro, which opens 2 different websites on 2 TABs,
and do some task forth and back on TAB 1 & TAB 2, when done, java script will run the second macro,
the second macro suppose to do some task on same opened tabs,
but second macro does not recognize TABs that have been opened in the first macro .

I want the second macro remember the opened TABs to be able to do some other tasks forth and back on these 2 TABs.

How Can I make it work?
Appreciate your help.
Hum, Thread has nothing specific to "Data Extraction", 'General' Sub-Forum would have been more appropriate...
And your Thread Title could use a "?", you are not sharing a 'HowTo'...

Well, simply make sure to finish your Macro_1 on TAB_1 with a "TAB T=1" at the end of the Macro, then TAB_1 for Macro_1 will also be TAB_1 for Macro_2. :idea:
If you let your Macro_1 finish on TAB_2, then this TAB becomes TAB_1 for Macro_2, and you would need to issue a "TAB T=0" to access TAB_1 from Macro_1, which works but is a bit of a cumbersome Workaround, I would think...

In some (more) complex Cases, you can assign a Var to your TAB Counter, to use like in:

Code: Select all

SET TAB_Nb 1
TAB T={{TAB_Nb}}
... and (Conditionally) increment/decrement it with 'ADD' and/or 'EVAL()', based maybe on some 'EXTRACT' on some Element on the Page that could help your Script "determine" on which TAB it currently is, and if it maybe needs to switch to the TAB on the Left or on the Right. (But watch out, the 'ADD' Command is buggy with "-0" if you may need to decrement, it will treat it as a String.)
I use the Conditional Switch to a different TAB indeed myself (based on some 'EXTRACT') in a few of my Macros, combined with a Conditional 'URL GOTO' depending on which TAB the Script "landed" and a Conditional TAB Close, and it works perfectly... 8)

For your "Calculation", it is also possible to access all first 8 TABs opened in your Browser Instance directly with 'Ctrl^[1-8]' , and the last TAB with 'Ctrl^9' (using the Number hard-coded or through a Var) using the 'EVENT' Mode, but I guess it's a bit cumbersome as well... I don't use it myself as my different FF or PM (Pale Moon) Instances/Profiles usually have [50-400] TABs open, so it's not very useful for me (and my Scripts always know exactly on which TAB they are anyway, ah-ah...!), but I had tested it once for some Thread...
- (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...
green.pine
Posts: 62
Joined: Thu Nov 04, 2010 5:21 pm

Re: how to carry TAB memory from one macro to another

Post by green.pine » Sun Oct 01, 2017 12:37 pm

Thanks for the reply; sorry about the ?
with use of a variable as you mentioned,
it is now working,
Post Reply