"IF" conditional, the mother of all problems ..... help?

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
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
jackofalltrades
Posts: 13
Joined: Wed Jan 24, 2018 4:37 pm

Re: "IF" conditional, the mother of all problems ..... help?

Post by jackofalltrades » Wed Jan 24, 2018 4:45 pm

Hi guys

I have a similar issue, can someone please help?

My webpage has a table, with a radio button at the end of each row, the button says 'Renew'

I want this radio button to be pressed only if that row of the table, contains a particular text string in a particular column

I have the actual button press, covered by my macro already:
TAG POS=1 TYPE=A ATTR=TXT:Renew

But I can't work out how to get the macro to query the text contents of that row and find the text string I need (the string is BA1). At present it just always chooses the first row in the table, I can't control that.

Any ideas please? Do I need JS, VB etc?

Thanks
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: "IF" conditional, the mother of all problems ..... help?

Post by chivracq » Wed Jan 24, 2018 5:16 pm

jackofalltrades wrote:Hi guys

I have a similar issue, can someone please help?

My webpage has a table, with a radio button at the end of each row, the button says 'Renew'

I want this radio button to be pressed only if that row of the table, contains a particular text string in a particular column

I have the actual button press, covered by my macro already:

Code: Select all

TAG POS=1 TYPE=A ATTR=TXT:Renew
But I can't work out how to get the macro to query the text contents of that row and find the text string I need (the string is BA1). At present it just always chooses the first row in the table, I can't control that.

Any ideas please? Do I need JS, VB etc?

Thanks
Hum..., that's already some "good old" Thread, ah-ah...!

CIM...! :mrgreen: (Read my Sig...)

But hum, @jack_xxx, if you read the Content of this current Thread a bit, the Solution I gave already nearly 4 years ago very probably works as well for your Case, and will then be the easiest one... :idea:
And nope..., you don't need any "JS, VB etc"...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
jackofalltrades
Posts: 13
Joined: Wed Jan 24, 2018 4:37 pm

Re: "IF" conditional, the mother of all problems ..... help?

Post by jackofalltrades » Fri Feb 02, 2018 6:30 am

Many thanks, this is working now! Slightly different column name for the postcode:

SET !TIMEOUT_STEP 0
TAG POS=1 TYPE=TD ATTR=CLASS:POSTCODE&&TXT:BA*
SET !TIMEOUT_STEP 0
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES

Now have a different problem which I have posted separately...
chivracq
Posts: 9374
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: "IF" conditional, the mother of all problems ..... help?

Post by chivracq » Fri Feb 02, 2018 3:01 pm

jackofalltrades wrote:Many thanks, this is working now! Slightly different column name for the postcode:

Code: Select all

SET !TIMEOUT_STEP 0
TAG POS=1 TYPE=TD ATTR=CLASS:POSTCODE&&TXT:BA*
SET !TIMEOUT_STEP 0
TAG POS=R-1 TYPE=INPUT:CHECKBOX FORM=NAME:* ATTR=NAME:* CONTENT=YES
Now have a different problem which I have posted separately...
Yep..., very good, exactly what I meant...! And Thanks for sharing your Script/Solution... :D

"Relative Positioning" is one of the "Basic" simple Techniques you can often use with iMacros to achieve some "Conditional Behaviour" in pure '.iim'.
More Info and other Techniques that I have mentioned and explained in the following Thread:
- Workarounds for Conditional Logic in Macro Code
I'm not sure if I had already posted a Link to this Thread in the current Thread as it is already 4 years old, and I'm too lazy to check the whole Content of the 2 Pages, but it doesn't hurt even if it's Double...

>>>

Hum..., like I was "afraid" in your next Thread, you missed the "CIM" part of my previous Reply in this one... :roll:
OK, never mind for this one, and your Script would work in all Browsers and all Versions anyway..., but like explained in my Sig, I usually don't read and certainly don't answer if FCI is not mentioned when opening a new Thread and I only sometimes make Exceptions for first-time-Posters if the "Quality" of the rest of the Content is not "too bad"...

>>>

Concerning the Script you posted, you don't need to repeat the '!TIMEOUT_STEP' Command before each 'TAG' Line.
The '!TIMEOUT_STEP' Command is a "Toggle" Command and that Setting remains active in your Script until you change it again with another '!TIMEOUT_STEP' Statement with a different Value, or if you use any '!TIMEOUT_PAGE' Statement, then '!TIMEOUT_STEP' automatically gets back to its Default Value (=10% of '!TIMEOUT_PAGE').
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply