imacros display message to user if page or text not found - imacros

My current imacros code calls a URL from a datasource. Should the URL not load (scheduled downtime or wifi is broken) it must display the relevant message to the user. I am unable to get any information on how to display the message to the user when there is downtime or the wifi is down. Below is what I got so far:
VERSION BUILD=844 RECORDER=CR
SET !FILE_PROFILER YES
'Clear the Cache and history'
CLEAR
'Close any open tabs'
TAB CLOSEALLOTHERS
SET !ERRORIGNORE NO
SET !TIMEOUT_STEP 13
'Navigate to the EBU Online URL'
SET !DATASOURCE_COLUMNS 1
CMDLINE !DATASOURCE Apps.csv
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO = {{!COL1}}
WAIT SECONDS=15
'There are no credentials for logging onto EBU Online'
Would appreciate any feedback, as I am new to imacros.
Windows 10
Chrome Version 61.0.3163.79 (Official Build) (64-bit)

If you want to display a message when there's no required text on the page, the following macro may help:
SET myText "imacros display message bla-bla-bla"
SET myScript "document.body.textContent.includes('{{myText}}') ? '' : alert('NO \"{{myText}}\" FOUND!');"
URL GOTO=javascript:{{myScript}}undefined;

Related

Auto Click a button until a specific text appear in page using iMacros

I'm trying to make an auto-click to a button on a website and do nothing when a specific text appears on the page
Using iMacros, how can I use if a specific text element had the value I wanted so it won't skip?
HTML:
<span class="tr-country" data-tr="IQ">Iraq</span>
<i class="flag message-flag flags-IQ"></i>
iMacros Recorder:
VERSION BUILD=1011 RECORDER=CR
URL GOTO=https://ometv.chat/
FRAME F=1
TAG POS=2 TYPE=DIV ATTR=TXT:next
TAG POS=2 TYPE=SPAN ATTR=TXT:South<SP>Africa (Some Random Country)
TAG POS=1 TYPE=I ATTR=CLASS:flag<SP>message-flag<SP>flags-ZA
What I want is to check if the class "tr-country" has the data-tr of "IQ" then we don't click/tag "next" button
How can I do that condition in iMacros?
Thanks in advance..
FCI:
iMacros for Chrome 10.1.1 Free
Windows 10 English
Version 96.0.4664.93 (Official Build) (64-bit)

iMacro issue posting to minds. com

The new social media site minds.com does not seem to have an API for posting, so I have tried to create a macro to do so from a single line text file, thus (iMacros for Firefox [50.1]). I have tried the x-y method and the conventional methods as well as the "experimental" mode, shown following:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
'SET !ERRORIGNORE YES
SET !DATASOURCE C:\[path-to-file]\[single line of text here].txt
SET !DATASOURCE_COLUMNS 1
SET !LOOP 1
'SET !DATASOURCE_LINE {{!LOOP}}
'SET !DATASOURCE_LINE {{1}}
URL GOTO=https://www.minds.com/newsfeed
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" CONTENT=Hi!
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS- NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>DIV>BUTTON" BUTTON=0
and I tried:
VERSION BUILD=9030808 RECORDER=FX
TAB T=1
URL GOTO=https://www.minds.com/newsfeed
SET !TIMEOUT_PAGE 30
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:message CONTENT=Hello!
TAG POS=1 TYPE=BUTTON FORM=NAME:NoFormName ATTR=ID:Post<SP>send
Neither seems to work, nor does an x-y click (which just highlights the 'Post' button but does not "click" it).
The salient HTML for the button is:
<button class="mdl-button mdl-button--colored" type="submit">
Post <i class="material-icons">send</i>
</button>
I'm not sure what I'm missing. Any suggestions would be greatly appreciated.
Thanks!
-Brian Brown, Ph.D.
This part of your macro must work fine:
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>TEXTAREA" CHARS="Hi !"
EVENT TYPE=CLICK SELECTOR="HTML>BODY>MINDS-APP>MINDS-BODY>MINDS-NEWSFEED>DIV>DIV>MINDS-NEWSFEED-POSTER>DIV>DIV>FORM>DIV>BUTTON" BUTTON=0
Doesn't it?

Imacros eval firefox

Currently using Imacros and got a problem, Im using
VERSION BUILD=8961227 RECORDER=FX
Windows 7
Firefox 44.0.1
Im trying to make something for instagram and Id like if it says follow then it will set the wait time to 30, if it says following it will change the Variable 7 to 0, so far the program will run but it will accept the if statement no matter if it says follow or following and set the wait time to 30, it wont pass it on to the else statement, any solutions?
VERSION BUILD=8961227 RECORDER=FX
TAB T=1
FILTER TYPE=IMAGES STATUS=OFF
SET !ERRORIGNORE YES
SET !TIMEOUT_PAGE 10
URL GOTO=https://www.instagram.com/instagram/
TAG POS=1 TYPE=BUTTON ATTR=TXT:* EXTRACT=TXT
SET !VAR0 {{!EXTRACT}}
SET !EXTRACT NULL
SET !VAR3 Follow
SET !VAR4 Following
SET !VAR7 EVAL("if (\"{{VAR0}}\" == \"{{VAR3}}\") {VAR7= 5;} else {VAR7= 0;}; ")
wait seconds = {{!VAR7}}
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
wait seconds = {{!VAR7}}
PROMPT EXTRACT:<SP>_{{!EXTRACT}}_<BR>VAR0:<SP>_{{!VAR0}}_<BR><BR>VAR3:<SP>_{{!VAR3}}_<BR>VAR4:<SP>_{{!VAR4}}_<BR><BR>VAR7:<SP>_{{!VAR7}}_
Try this EVAL statement:
SET !VAR7 EVAL("('{{!VAR0}}' == '{{!VAR3}}') ? 30 : 0;")

go to the next step if {{!EXTRACT}} is true

i'm new here and newbie in imacros and javascript
I have made a script that will extract a random word from a page with a regex syntax.
The script is working fine, is going to page.. is search for the word and if is there will extract the word.
But i need that the script is to refresh the page until the word is found and after that to run the second imacro script
VERSION BUILD=8961227 RECORDER=FX
SET !TIMEOUT 1
SET !ERRORIGNORE YES
TAB T=1
URL GOTO=url
SEARCH SOURCE=REGEXP:"raspuns":\[\"(.[^"]*)" EXTRACT=$1
SET !VAR1 {{!EXTRACT}}
and if the word is found run the second script (if not refesh)
TAB T=2
URL GOTO=url
TAG POS=1 TYPE=TEXTAREA ATTR=AUTOCOMPLETE:off CONTENT={{!EXTRACT}}
TAG POS=1 TYPE=BUTTON ATTR=CLICK:sendMessage()&&CLASS:go&&TXT:
anyone can help me with this?
Not super sure if I know exactly what you want and as it is imacros there are some weird workarounds but this might help you
VERSION BUILD=8961227 RECORDER=FX
SET !TIMEOUT 1
SET !ERRORIGNORE YES
TAB T=1
URL GOTO=url
SEARCH SOURCE=REGEXP:"raspuns":\[\"(.[^"]*)" EXTRACT=$1
SET !VAR0 raspuns
SET !VAR1 {{!EXTRACT}}
SET !EXTRACT NULL
SET !VAR2 EVAL("('{{!VAR0}}' == '{{!VAR1}}') ? 1 : 0;")
TAB T=2
URL GOTO=url
TAG POS={{!VAR2}} TYPE=TEXTAREA ATTR=AUTOCOMPLETE:off CONTENT={{!EXTRACT}}
TAG POS={{!VAR2}} TYPE=BUTTON ATTR=CLICK:sendMessage()&&CLASS:go&&TXT:
As you didnt give a url its very hard for me to test, but point is, if if takes the word youre looking for, raspun, it will set the TAG position to 1, therefore tagging what you need, but if it doesnt, it will set the TAG pos = 0, therefore just passing through the code, hope that helps

Imacros Login With Proxy

I want to make a imacros script for firefox where I can load a list of emails (email:password) then login them to a website using a proxy list (ip:port). How do I do that?
So basically my process will be like this:
visit a website using proxy > login using email1 on the list > upvote a comment > logout
Next process will be the same but the proxy will change (from the list of proxy) and then pick email2 to login and do the same process.
For future reference, create a csv file with ip,port
SET !LOOP 2
SET !DATASOURCE C:\Temp\ips.csv
SET !DATASOURCE_LINE {{!LOOP}}
PROXY ADDRESS={{!COL1}}:{{!COL2}} BYPASS=*google.com*