If Else statement how to?

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.

If Else statement how to?

by krkannan94 on Thu Jun 15, 2017 10:13 pm

hi everyone :) I want to code iMacros to automatically refresh if it doesn't found the text "WELCOME"

I'm using iMacros v9.0.3 on Firefox 53.0.3 (64 bit) in Windows 8 x64

IF the script found the word "WELCOME"

Code: Select all
TAB T=1
TAG POS=1 TYPE=DIV ATTR=TXT:WELCOME


THEN run rest of the script

Code: Select all
SET !TIMEOUT_STEP 100
TAG POS=1 TYPE=DIV ATTR=TXT:IN CONTENT=EVENT:MOUSEOVER
WAIT SECONDS=3
EVENT TYPE=CLICK SELECTOR="#watch8-sentiment-actions>SPAN>SPAN>BUTTON" BUTTON=0
TAB T=2
WAIT SECONDS=8
TAB T=1
TAB CLOSEALLOTHERS
WAIT SECONDS=5


ELSE

Code: Select all
REFRESH


anyone know how to solve this problem ?? and thanks in advance :) :)
krkannan94
 
Posts: 19
Joined: Wed May 24, 2017 10:04 pm

Re: If Else statement how to?

by chivracq on Fri Jun 16, 2017 2:49 am

krkannan94 wrote:hi everyone :) I want to code iMacros to automatically refresh if it doesn't found the text "WELCOME"

I'm using
Code: Select all
iMacros v9.0.3 on Firefox 53.0.3 (64 bit) in Windows 8 x64


IF the script found the word "WELCOME"

Code: Select all
TAB T=1
TAG POS=1 TYPE=DIV ATTR=TXT:WELCOME


THEN run rest of the script

Code: Select all
SET !TIMEOUT_STEP 100
TAG POS=1 TYPE=DIV ATTR=TXT:IN CONTENT=EVENT:MOUSEOVER
WAIT SECONDS=3
EVENT TYPE=CLICK SELECTOR="#watch8-sentiment-actions>SPAN>SPAN>BUTTON" BUTTON=0
TAB T=2
WAIT SECONDS=8
TAB T=1
TAB CLOSEALLOTHERS
WAIT SECONDS=5


ELSE

Code: Select all
REFRESH


anyone know how to solve this problem ?? and thanks in advance :) :)

Well, it's not a "problem", it's just a typical iMacros Case/Use, ah-ah...!

=> Yep, use a '.js' Script...!

You can do 'it" in pure '.iim', if a Reload of the Page with 'URL GOTO' is OK, a Conditional 'REFRESH' is more complicated and uses a Trick/Syntax that doesn't work anymore in v9.0.3, and except the "Conditional" 'TAB CLOSEALLOTHERS' maybe, but I never use it, so I never tried...
Have a look at the following Thread + search the Forum for "Conditional 'WAIT'" for all your 'WAIT' Statements...:
- Workarounds for Conditional Logic in Macro Code
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 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: 5730
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot] and 9 guests

Website Monitoring