Switch account IF exist a text on the page

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
Post Reply
pauloswear
Posts: 7
Joined: Tue May 19, 2020 4:07 pm

Switch account IF exist a text on the page

Post by pauloswear » Tue Aug 18, 2020 6:31 am

Hi guys, i am losing my sleep.. Now it's 3:20 A.M and here i am trying to code something...
I appreciate any help or idea :idea:

Well, i am using latest basilisk running on windows 10 1909 18363.418
  • VERSION BUILD=8970419 RECORDER=FX
Well, I would like to use some if and else statements to logout and login on social media website when an extracted text from this social website is present...

Until now i did this system to login/logout

Code: Select all

'------------------DEFINIÇÕES------------------
SET user mysexyuser
SET master_password mysexypassword
'----------------------------------------------

'---------------------LOGIN--------------------
TAB T=1
URL GOTO=https://www.socialwebsite.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginForm ATTR=NAME:username CONTENT={{user}}
WAIT SECONDS=0.1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginForm ATTR=NAME:password CONTENT={{master_password}}
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON FORM=ID:loginForm ATTR=TXT:Log<SP>In
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON ATTR=TXT:Not<SP>Now
WAIT SECONDS=1

'-------------------LOGOUT---------------------
SET URL EVAL("'www.socialwebsite.com' + '/'+'{{user}}'")
URL GOTO={{URL}}
SET URL NULL
WAIT SECONDS=0.1
TAG POS=1 TYPE=BUTTON ATTR=CLASS:wpO6b<SP>&&TYPE:button&&TXT:
WAIT SECONDS=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Log<SP>Out
Well, this is working fine... but i have to implement this using if and else...
IF

this extract on mysexyvar is present:

Code: Select all

TAG POS=1 TYPE=BUTTON ATTR=TXT:Report<SP>a<SP>Problem EXTRACT=TXT
SET MYSEXYVAR {{!EXTRACT}}
THEN

Code: Select all

'-------------------LOGOUT---------------------
SET URL EVAL("'www.socialwebsite.com' + '/'+'{{user}}'")
URL GOTO={{URL}}
SET URL NULL
WAIT SECONDS=0.1
TAG POS=1 TYPE=BUTTON ATTR=CLASS:wpO6b<SP>&&TYPE:button&&TXT:
WAIT SECONDS=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Log<SP>Out
'----------------------------------------------------

'---------------------LOGIN--------------------
TAB T=1
URL GOTO=https://www.socialwebsite.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginForm ATTR=NAME:username CONTENT={{user}}
WAIT SECONDS=0.1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginForm ATTR=NAME:password CONTENT={{master_password}}
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON FORM=ID:loginForm ATTR=TXT:Log<SP>In
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON ATTR=TXT:Not<SP>Now
WAIT SECONDS=1
ELSE

RUN THE REST OF SCRIPTTING CODE UNTIL NEXT LOOP TO CHECK IT AGAIN

I would like any suggestion, any help or any idea... everything is welcome
chivracq
Posts: 9762
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Switch account IF exist a text on the page

Post by chivracq » Tue Aug 18, 2020 2:05 pm

pauloswear wrote:
Tue Aug 18, 2020 6:31 am
Hi guys, i am losing my sleep.. Now it's 3:20 A.M and here i am trying to code something...
I appreciate any help or idea :idea:

Well, i am using

Code: Select all

latest basilisk running on windows 10 1909 18363.418

[list]VERSION BUILD=8970419 RECORDER=FX[/list]
Well, I would like to use some if and else statements to logout and login on social media website when an extracted text from this social website is present...

Until now i did this system to login/logout

Code: Select all

'------------------DEFINIÇÕES------------------
SET user mysexyuser
SET master_password mysexypassword
'----------------------------------------------

'---------------------LOGIN--------------------
TAB T=1
URL GOTO=https://www.socialwebsite.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginForm ATTR=NAME:username CONTENT={{user}}
WAIT SECONDS=0.1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginForm ATTR=NAME:password CONTENT={{master_password}}
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON FORM=ID:loginForm ATTR=TXT:Log<SP>In
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON ATTR=TXT:Not<SP>Now
WAIT SECONDS=1

'-------------------LOGOUT---------------------
SET URL EVAL("'www.socialwebsite.com' + '/'+'{{user}}'")
URL GOTO={{URL}}
SET URL NULL
WAIT SECONDS=0.1
TAG POS=1 TYPE=BUTTON ATTR=CLASS:wpO6b<SP>&&TYPE:button&&TXT:
WAIT SECONDS=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Log<SP>Out
Well, this is working fine... but i have to implement this using if and else...
IF

this extract on mysexyvar is present:

Code: Select all

TAG POS=1 TYPE=BUTTON ATTR=TXT:Report<SP>a<SP>Problem EXTRACT=TXT
SET MYSEXYVAR {{!EXTRACT}}
THEN

Code: Select all

'-------------------LOGOUT---------------------
SET URL EVAL("'www.socialwebsite.com' + '/'+'{{user}}'")
URL GOTO={{URL}}
SET URL NULL
WAIT SECONDS=0.1
TAG POS=1 TYPE=BUTTON ATTR=CLASS:wpO6b<SP>&&TYPE:button&&TXT:
WAIT SECONDS=0.5
TAG POS=1 TYPE=BUTTON ATTR=TXT:Log<SP>Out
'----------------------------------------------------

'---------------------LOGIN--------------------
TAB T=1
URL GOTO=https://www.socialwebsite.com/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:loginForm ATTR=NAME:username CONTENT={{user}}
WAIT SECONDS=0.1
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ID:loginForm ATTR=NAME:password CONTENT={{master_password}}
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON FORM=ID:loginForm ATTR=TXT:Log<SP>In
WAIT SECONDS=1
TAG POS=1 TYPE=BUTTON ATTR=TXT:Not<SP>Now
WAIT SECONDS=1
ELSE

RUN THE REST OF SCRIPTTING CODE UNTIL NEXT LOOP TO CHECK IT AGAIN

I would like any suggestion, any help or any idea... everything is welcome

Hum..., pay attention to open your Threads in the "correct" Sub-Forum, I had already stressed about that for your first/previous Thread, this one has nothing "very" specific to the 'iMacros for FF' Sub-Forum, except maybe that as you are using v8.9.7 for FF, it would be possible to implement the 'if/then/else' Conditional Logic using a '.js' Script... But it can also be implemented in pure '.iim'...
(And I usually don't answer when a Thread was opened in some "random" Sub-Forum, or at least until it has been moved to the "correct" one...)

And "latest" doesn't mean much on a Tech Forum, simply mention the exact Version when you mention your FCI...

>>>

Then OK, concerning your Scenario, hum-hum..., I don't really follow/understand your Workflow exactly, especially why you need to log out to then directly log in again in the 'THEN' Section, and it's not clear if you are already on that same 'socialwebsite' in the 'IF' Section, but anyway, your 'THEN' Section begins with an 'URL GOTO' Command for which you already compute/build the URL using 'EVAL()', then you can already extend that 'EVAL()' to conditionally compute your 'socialwebsite' URL or an Empty String based on the Content of the 'EXTRACT'.
'URL GOTO' + an 'Empty String' won't do anything...

(Calling your URL "URL" is btw not "really" a Good Practice, as 'URL' is also an iMacros Command (in 'URL GOTO'), you might get some "unexpected" Behaviour by using Reserved Keywords/Commands for your own User-Defined Vars...)

In order to "quickly" bypass the next Statements, (after the 'URL GOTO'), you would need to add '!ERRORIGNORE' + a short '!TIMEOUT_STEP' (=0) at the beginning of the 'THEN' Section.

And if that's "not enough", and that for example the 'Logout' Statement might still log you out from the Site (and you don't want that), then next to the Conditional 'URL GOTO' at the beginning of the 'THEN' Section, you could also add a Conditional Switch to a Dummy 'TAB_2' (already opened on some 'google.com' Page for example) where the 'Logout' won't do anything...
This is a Technique I use to "mute" a complete Section in a Script to do nothing... (or I send the Script to some non-existing Page on "the" Site...).

>>>

And mini-Rmk, but your "SET MyVar NULL" has no Use, I think only the '!EXTRACT' Var "understands" the "NULL" Command with 'SET', all other Vars will interpret "NULL" as the Literal String "NULL"...
- (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...
pauloswear
Posts: 7
Joined: Tue May 19, 2020 4:07 pm

Re: Switch account IF exist a text on the page

Post by pauloswear » Tue Aug 18, 2020 7:30 pm

Ok, dont be stressed, this is not good for health.

I was thinking, can I switch (at least) iMacros scripts if some text is preset on the page?

I am using this EVAL to compare variables,

Code: Select all

SET ESPERA EVAL("('{{PAG_EXTRACT}}' == '{{EXTRAIDO}}') ? 3 : 0;")
I was thinking in give a string name that represets next script to this variable...

In the beginning of section i got this parameters

Code: Select all

SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !REPLAYSPEED FAST
SET !TIMEOUT_PAGE 30
SET !TIMEOUT_STEP 0
SET !LOOP -9999999
SET !ENCRYPTION NO
SET !EXTRACT NULL
SET EXTRAIDO NULL
SET ESPERA NULL
SET PAG_EXTRACT NULL
I have to use this code because this social website actually block the account after do some actions, then i will need to logout and login with other account...
chivracq
Posts: 9762
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Switch account IF exist a text on the page

Post by chivracq » Mon Aug 24, 2020 5:11 pm

pauloswear wrote:
Tue Aug 18, 2020 7:30 pm
Ok, dont be stressed, this is not good for health.

I was thinking, can I switch (at least) iMacros scripts if some text is preset on the page?

I am using this EVAL to compare variables,

Code: Select all

SET ESPERA EVAL("('{{PAG_EXTRACT}}' == '{{EXTRAIDO}}') ? 3 : 0;")
I was thinking in give a string name that represets next script to this variable...

In the beginning of section i got this parameters

Code: Select all

SET !EXTRACT_TEST_POPUP NO
SET !ERRORIGNORE YES
SET !REPLAYSPEED FAST
SET !TIMEOUT_PAGE 30
SET !TIMEOUT_STEP 0
SET !LOOP -9999999
SET !ENCRYPTION NO
SET !EXTRACT NULL
SET EXTRAIDO NULL
SET ESPERA NULL
SET PAG_EXTRACT NULL
I have to use this code because this social website actually block the account after do some actions, then i will need to logout and login with other account...

Oh...!?, I had missed this Reply of yours, I only "see" it now... :o

But hum..., OK, I don't really "see" the "full picture", this 2nd Script (or part of your Script) has no "real Use", it's not doing anything, setting all those Vars to "NULL" has no Use, I've already told you, even for '!EXTRACT' at the Beginning of your Script...
Setting '!REPLAYSPEED' to "FAST" has also no "real" Use, as that's already the Default... Unless you sometimes change that Setting manually to slow your Script..., then it's "quicker" to simply (un)comment out the Line...

Then I don't know what you are extracting, not posted, and you didn't post either what you are further doing with this 'ESPERA' Var from the 'EVAL()'... I can't follow your Script and what you are (trying to) do(ing) if you don't post the whole Script...

And I'm not sure what you mean by "if some text is preset", maybe you mean "present" and related to whatever you might be extracting...

But OK, I already gave you some "Generic" Advice and what Techniques you could use, I usually don't help for Social Media anyway..., and even less when the Site/URL is not posted... :|
- (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