Help writing code iMacros and 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
RayB
Posts: 34
Joined: Sat Mar 28, 2015 4:19 pm

Help writing code iMacros and tabs

Post by RayB » Mon Jul 23, 2018 2:54 am

Hello,

I am running W7 HomePremium with IMacros VERSION BUILD=10021450 on FF 61.0.1 (32-bit).

I use IMacros to move pictures within my collection on a large server. I am having to rewrite all of my old macros since upgrading to the latest version which has some pretty severe line limits.

I have posted the macro below which is what I am working on. Basically I start on a web page which contains up to 26 pictures. I run the macro using the Play Loop with the count set to the number of pictures on the page.

VERSION BUILD=8890130 RECORDER=FX
SET !VAR3 {{!LOOP}}
ADD !VAR3 {{!LOOP}}
ADD !VAR3 -1
TAB T={{!VAR3}}
SET !VAR1 {{!URLCURRENT}}
SET !VAR2 {{!LOOP}}
TAB OPEN NEW
ADD !VAR3 1
TAB T={{!VAR3}}
URL GOTO={{!VAR1}}
WAIT SECONDS= 3
TAG POS={{!VAR2}} TYPE=IMG ATTR=ALT:*&&SRC:http://www.***.net/gallery/data/*/thumbs/*&&TITLE:*&&CLASS:imgborder
TAG POS=1 TYPE=A ATTR=HREF:http://www.***.net/gallery/editphoto.php?phoedit=*&&TITLE:Edit<SP>Photo
TAB OPEN NEW
ADD !VAR3 1
TAB T={{!VAR3}}
URL GOTO={{!VAR1}}
WAIT SECONDS= 3

As you can see I grab the starting page URL and then use it on future pages to start the photo selection process. The WAIT SECONDS=3 are included to make sure the page is loaded (this server does not seem to use the complete page information).

Using 4 pictures on a page as an example I end up with the beginning page on TAB 1, then the first picture open for editing on TAB 2, then the beginning page on TAB 3, then the second picture open for editing on TAB 4, then the beginning page on TAB 5, then the third picture open for editing on TAB 6, then the beginning page on TAB 7, then the fourth picture open for editing on TAB 8.

What I would like to end up with through better programming (hopefully saves run time) is the beginning page on TAB 1, then the first picture open for editing on TAB 2, then the second picture open for editing on TAB 3, then the third picture open for editing on TAB 4, then the fourth picture open for editing on TAB 5.

My old version of this macro used repetitions of the same code and changed the tab numbers but is too many lines for the new iMacros version.

I appreciate any help you can provide!

Thank You
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Help writing code iMacros and tabs

Post by chivracq » Fri Jul 27, 2018 1:27 am

RayB wrote:Hello,

I am running

Code: Select all

W7 HomePremium with IMacros VERSION BUILD=10021450 on FF 61.0.1 (32-bit).
I use IMacros to move pictures within my collection on a large server. I am having to rewrite all of my old macros since upgrading to the latest version which has some pretty severe line limits.

I have posted the macro below which is what I am working on. Basically I start on a web page which contains up to 26 pictures. I run the macro using the Play Loop with the count set to the number of pictures on the page.

Code: Select all

VERSION BUILD=8890130 RECORDER=FX
SET !VAR3 {{!LOOP}}
ADD !VAR3 {{!LOOP}}
ADD !VAR3 -1
TAB T={{!VAR3}}
SET !VAR1 {{!URLCURRENT}}
SET !VAR2 {{!LOOP}}
TAB OPEN NEW
ADD !VAR3 1
TAB T={{!VAR3}}
URL GOTO={{!VAR1}}
WAIT SECONDS= 3
TAG POS={{!VAR2}} TYPE=IMG ATTR=ALT:*&&SRC:http://www.***.net/gallery/data/*/thumbs/*&&TITLE:*&&CLASS:imgborder
TAG POS=1 TYPE=A ATTR=HREF:http://www.***.net/gallery/editphoto.php?phoedit=*&&TITLE:Edit<SP>Photo
TAB OPEN NEW
ADD !VAR3 1
TAB T={{!VAR3}}
URL GOTO={{!VAR1}}
WAIT SECONDS= 3
As you can see I grab the starting page URL and then use it on future pages to start the photo selection process. The WAIT SECONDS=3 are included to make sure the page is loaded (this server does not seem to use the complete page information).

Using 4 pictures on a page as an example I end up with the beginning page on TAB 1, then the first picture open for editing on TAB 2, then the beginning page on TAB 3, then the second picture open for editing on TAB 4, then the beginning page on TAB 5, then the third picture open for editing on TAB 6, then the beginning page on TAB 7, then the fourth picture open for editing on TAB 8.

What I would like to end up with through better programming (hopefully saves run time) is the beginning page on TAB 1, then the first picture open for editing on TAB 2, then the second picture open for editing on TAB 3, then the third picture open for editing on TAB 4, then the fourth picture open for editing on TAB 5.

My old version of this macro used repetitions of the same code and changed the tab numbers but is too many lines for the new iMacros version.

I appreciate any help you can provide!

Thank You
Okay..., only "useful" Word in your Thread Title is "tabs" about its Content, so your Thread is about controlling TAB Navigation, with Loop x26...
[...] beginning page on TAB 1, then the first picture open for editing on TAB 2, then the second picture open for editing on TAB 3, then the third picture open for editing on TAB 4, then the fourth picture open for editing on TAB 5.
=> Yeah, well, go back to 'TAB_1' on each Loop with a 'TAB T=1', I would think... Simple...! It normally gets recorded in Scripts in Record Mode, dunno why you've removed it... :?

Do some 'TAB CLOSE' after each 'TAB T=n', then you are sure to get back to 'TAB_1' anyway..., it all depends a bit on your Site (URL not mentioned) how they handle clicking on Links and if they open a new Tab, and I don't know what this 'TAB OPEN NEW' is supposed to do (now...!), a bit "new" in v10.0.2 for FF I guess, even if that was some very old deprecated Command/Syntax from 8-10 years ago, no Idea why it came back in v10.0.2 for FF, ah-ah...! :?
- (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