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

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

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: "IF" conditional, the mother of all problems ..... help?

by jackofalltrades on Wed Jan 24, 2018 9:45 am

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
jackofalltrades
 
Posts: 10
Joined: Wed Jan 24, 2018 9:37 am

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

by chivracq on Wed Jan 24, 2018 10:16 am

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)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...
chivracq
 
Posts: 6687
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

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

by jackofalltrades on Thu Feb 01, 2018 11:30 pm

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...
jackofalltrades
 
Posts: 10
Joined: Wed Jan 24, 2018 9:37 am

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

by chivracq on Fri Feb 02, 2018 8:01 am

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)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...
chivracq
 
Posts: 6687
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Previous

Return to iMacros for Firefox

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot] and 8 guests

-->