Opening sites in new tabs

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
alex4478
Posts: 22
Joined: Tue Oct 15, 2013 7:56 pm

Opening sites in new tabs

Post by alex4478 » Fri Jan 03, 2014 7:25 pm

Hi All,

What I'm trying to do is by using a list of sites have imacros read the list and open a new tab in each list. Would someone be kind enough to let me know the script that can get this done?

Many thanks.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Opening sites in new tabs

Post by chivracq » Sun Jan 05, 2014 12:58 pm

I just answered a similar Post:
Re: Helps me to open multiple links same time !

You skip the first part because you already have the URL's, you just grab them from your .CSV File and you open them in each Tab with URL GOTO={{!COL1}}...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
alex4478
Posts: 22
Joined: Tue Oct 15, 2013 7:56 pm

Re: Opening sites in new tabs

Post by alex4478 » Sun Jan 05, 2014 1:54 pm

Great thanks for the help.

I'm now a stage further and would like help with the next part.

It may be better if I explain the whole thing.

I have a website which has URLs on it, this page changes every so often and what I'd like to be able to do is when I first open the page to have part of every URL added to a fixed URL so that the new URL opens in a new tab. If that not tricky enough I'd also like the first webpage to be monitored so that if a new URL is posted to the site then a new tab is opened to accommodate the new URL.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Opening sites in new tabs

Post by chivracq » Mon Jan 06, 2014 1:45 am

alex4478 wrote:Great thanks for the help.

I'm now a stage further and would like help with the next part.

It may be better if I explain the whole thing.

I have a website which has URLs on it, this page changes every so often and what I'd like to be able to do is when I first open the page to have part of every URL added to a fixed URL so that the new URL opens in a new tab. If that not tricky enough I'd also like the first webpage to be monitored so that if a new URL is posted to the site then a new tab is opened to accommodate the new URL.
I did my part of the job, I don't understand anything of your second set of questions..., give your Script and where you get stuck, with the URL of the Site of course if you want me or anybody else to dig into your problematic...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
alex4478
Posts: 22
Joined: Tue Oct 15, 2013 7:56 pm

Re: Opening sites in new tabs

Post by alex4478 » Mon Jan 06, 2014 1:46 pm

I'll try and explain a little better and make the URL's up as I would like to keep client information private, hope that's OK?

Browser1=1st Instance of Firefox
Browser2=2nd Instance of Firefox
CSV_1=list of urls extracted from webpage1
CSV_2=ammended list of URLs

So Browser1 is pointing at a website (www.abc.com) and on that page is a table which is showing a list of URL's. The list is ranked by % and is feed from another source. I'd like imacros to read that list of URLs and save it to a CSV file (CSV_1).

Excel can be setup to read data from a file even if that file is not open, so CSV_2 will be an Excel file which reads the data in CSV_1 and changes the URL so that it will go to a different address. The point here is that the first set of URLs has a string of text which must be included in the second set of URLs.

Browser2 needs to be able to read CSV_2 and open the list of URLs in seperate browser windows.

Of course if there is an easier way of doing this then I'm listening ...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Opening sites in new tabs

Post by chivracq » Mon Jan 06, 2014 5:27 pm

It's now indeed a little bit more clear...
alex4478 wrote:Browser2 needs to be able to read CSV_2 and open the list of URLs in seperate browser windows.
For that part, I already gave you some kind of a Solution in the Script I mentioned for the other User...
alex4478 wrote:So Browser1 is pointing at a website (http://www.abc.com) and on that page is a table which is showing a list of URL's. The list is ranked by % and is feed from another source. I'd like imacros to read that list of URLs and save it to a CSV file (CSV_1).
Ah OK, so you do need to extract a List of URL's, well that's what was more or less in Part 1 of the Script I already mentioned..., except that that User didn't need to save the URL's but just wanted to open them directly in new Tabs. In order to save the URL's in a .CSV File, you'll need to use EXTRACT and SAVEAS, but in my quick and dirty Solution tailored for that specific Site that the User mentioned, I already used and actually misused EXTRACT in order not to click on the Laptop Images that were Links as well to use them for Relative Positioning to locate the URL's.

(I could have used "TAG POS=n TYPE=A ATTR=TXT:* EXTRACT=HREF" (instead of "TAG POS=R1"), but identifying the right Sequence for n proved to be some hassle, because there were many other Links on that Page and I suspected the User would want to reuse that Script for other Pages, so my Solution was more generic, to give him the Method...)

For the EXTRACT Part, in that specific case, you'd need to handle it yourself using a TEMP Variable to store the Content of !EXTRACT, depending if you do your SAVEAS after each URL Extraction or at the end of your Macro.
alex4478 wrote:Excel can be setup to read data from a file even if that file is not open, so CSV_2 will be an Excel file which reads the data in CSV_1 and changes the URL so that it will go to a different address. The point here is that the first set of URLs has a string of text which must be included in the second set of URLs.
So you let Excel do the String Manipulation for the URL's between the 2 .CSV's, OK, interesting Solution, I would be interested to know how you do that, if you want to share...? (Hum, using Datasource maybe...)
Depending on if you (don't) want to keep both the Original URL's and the Computed URL's, you could have done it otherwise using EVAL... But even if you need to keep both, you can save them twice in the 2 different .CSV's...
alex4478 wrote:Of course if there is an easier way of doing this then I'm listening ...
Using 2 Instances of Firefox means using 2 Separate Macros, which means that you cannot synchronize the Execution of the 2 Macros, but that seems to be a Requirement for you...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
alex4478
Posts: 22
Joined: Tue Oct 15, 2013 7:56 pm

Re: Opening sites in new tabs

Post by alex4478 » Mon Jan 06, 2014 9:10 pm

Thank you very much for the long reply, loads to go on.

I've scan read your reply and will digest more at work tomorrow, but to answer the "if there is an easier way" comment, I had a suspicion that imacros could handle the whole thing in one script, and would be keen to take that route, but I was keen to break it down into stages, perhaps more for my own understanding.

I was going to use Excel and the datasource function, not sure if that was going to work.

Thanks once again for your help.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Opening sites in new tabs

Post by chivracq » Tue Jan 07, 2014 12:16 am

Of course you can do it with one Script... You grab your URL's one by one, do your String Manipulation for each URL with EVAL and save both URL's Line by Line in the same .CSV File, which you reuse a bit further in your Script in the Part where you open all new URL's in Tabs...

Using Excel is great to populate a Spreadsheet with External Data from External Datasources, but that sounds a bit heavy to me for what you'll be doing with the URL's, unless the String Manipulation is so complex that you can't handle it with one EVAL Javascript Statement.
(And as far as I remember, it's been some 8 or 10 years ago that I used External Datasource in Excel for the last time, Excel was reading the External Datasource only when opening the File, changes in the External Datasource were not taken into account in real time, and you'd need as well some User intervention to commit the Changes in .CSV2 after the String Manipulation, but maybe there are more Config-Options now...)
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
alex4478
Posts: 22
Joined: Tue Oct 15, 2013 7:56 pm

Re: Opening sites in new tabs

Post by alex4478 » Tue Jan 07, 2014 2:21 pm

Thankyou so much for the information you have so far provided.

Would you be so kind to write the script for me? It is very cheeky of me to ask.

I've understand the logic of what you are saying but when it comes to the creating I just can't do it, I get "lost" with all the different symbols and the syntax. I have tried to learn programming other languages but have encountered the same thing.

the site to use is http://www.bbc.com/news/ and I'd like the headline URLs changed so that rather than .com it is .co.uk and then the URLs open in new browser tabs, but is there a way to prevent the same tab from being opened up twice and also refresh the 1st page so as to be able to open up newly added headlines in a new tab.
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Opening sites in new tabs

Post by chivracq » Tue Jan 07, 2014 10:00 pm

Hum..., I find all this a little bit useless, because I monitored the BBC Web-Site since you last posted, you only have 3 Headlines that didn't change for 6 hours, so a Refresh mechanism is a bit useless..., they all have a Picture that you can use as an Anchor for Relative Positioning like I did in the Example I already mentioned earlier for another Thread, so you just need to adapt the same Method. And I don't understand why you wanted to use a .CSV File...

And honestly, it's much quicker to open the 3 Links with a Click of the Scrolling Wheel of your Mouse (= Open in New Tab) than to locate a Macro and launch it... And btw, all the Links open automatically in .co.uk, only the Home Page exists in both .com and .co.uk (with the same Content)...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Post Reply