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
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'/'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...