How to skip a line if condition is met.

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
elyfrank
Posts: 8
Joined: Sun Feb 05, 2017 7:33 pm

How to skip a line if condition is met.

Post by elyfrank » Sat Sep 08, 2018 5:30 pm

My question is:
How can I check if POS 4 class is "toggle btn btn-default off" and then skip the imacro pos 4 line?
My guess is that I will have to use either the eval or some javascript to achieve this, but I really don't know.
Thanks a lot guys.

This is the code from the website:

Code: Select all

<fieldset class="option">
                <legend>Specifications</legend>
                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="popup" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline" for="popup">
            
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="popup2" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="sound" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                     
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-default off" data-toggle="toggle" style="width: 100px; height: 35px;"><input id="hatpopup3" data-toggle="toggle" data-width="100" data-height="35" name="popup2" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>


                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                    
                        </label>
                    </div>
				</div>
            </fieldset>

This is part the iMacro code I have which toggles the buttons with no problem as long as all the class are set to "toggle btn btn-primary" when I open the page.

TAG POS=1 TYPE=LABEL ATTR=TXT:Yes
TAG POS=2 TYPE=LABEL ATTR=TXT:Yes
TAG POS=3 TYPE=LABEL ATTR=TXT:Yes
TAG POS=4 TYPE=LABEL ATTR=TXT:Yes
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to skip a line if condition is met.

Post by chivracq » Sat Sep 08, 2018 5:48 pm

elyfrank wrote:My question is:
How can I check if POS 4 class is "toggle btn btn-default off" and then skip the imacro pos 4 line?
My guess is that I will have to use either the eval or some javascript to achieve this, but I really don't know.
Thanks a lot guys.

This is the code from the website:

Code: Select all

<fieldset class="option">
                <legend>Specifications</legend>
                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="popup" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline" for="popup">
            
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="popup2" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-primary" data-toggle="toggle" style="width: 100px; height: 35px;"><input data-toggle="toggle" data-width="100" data-height="35" checked="" name="sound" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>
                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                     
                        </label>
                    </div>

                </div>

                <div class="row">
                    <div class="col-xs-12 col-sm-2 text-right">
                        <div class="toggle btn btn-default off" data-toggle="toggle" style="width: 100px; height: 35px;"><input id="hatpopup3" data-toggle="toggle" data-width="100" data-height="35" name="popup2" value="ja" data-on="Yes" data-off="No" type="checkbox"><div class="toggle-group"><label class="btn btn-primary toggle-on" style="line-height: 19px;">Yes</label><label class="btn btn-default active toggle-off" style="line-height: 19px;">No</label><span class="toggle-handle btn btn-default"></span></div></div>
                    </div>


                    <div class="col-xs-12 col-sm-10">
                        <label class="checkbox-inline">
                    
                        </label>
                    </div>
				</div>
            </fieldset>

This is part the iMacro code I have which toggles the buttons with no problem as long as all the class are set to "toggle btn btn-primary" when I open the page.

Code: Select all

   TAG POS=1 TYPE=LABEL ATTR=TXT:Yes
   TAG POS=2 TYPE=LABEL ATTR=TXT:Yes
   TAG POS=3 TYPE=LABEL ATTR=TXT:Yes
   TAG POS=4 TYPE=LABEL ATTR=TXT:Yes
Hum..., ouf-ouf..., I'm afraid we are going to have the same "Discussion" like in your previous Tread, ah-ah...! 8)
=> CIM...! :mrgreen: (Read my Sig...)

But yep, easy to implement, with an 'EXTRACT=CHECKED' (on the 'CB' directly, not on the 'LABEL'), then use 'EVAL()' to compute a "4"/"0" to reuse for 'POS=n'... :idea:
- (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...
elyfrank
Posts: 8
Joined: Sun Feb 05, 2017 7:33 pm

Re: How to skip a line if condition is met.

Post by elyfrank » Sun Sep 09, 2018 1:57 pm

I Read the previous tread, I apologize for that. There are multiple people in my office using the same username.
Thanks a lot. Worked great!
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to skip a line if condition is met.

Post by chivracq » Sun Sep 09, 2018 3:51 pm

elyfrank wrote:I Read the previous tread, I apologize for that. There are multiple people in my office using the same username.
Thanks a lot. Worked great!
Yeah well, then one among you should read one day the Forum Rules (for Required Tech Info to include in your OP when you open a Thread) + to answer my Qt's when I ask for it..., and to share your Solution / Final Script to make those Threads a bit useful for other Users as well or it was probably the last time I was reacting to one of your Threads to help you... :idea:
- (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