@alexjohnhamber12 said in IF Statement Help:
@Fox bro i have to use this script in my bas where i will paste these codes:)
The message contains a script file, you need to save it on your PC and open it in BAS.
Heyo!
Im doing a BAS, and trying to see if this can work.
Get Element Text, [[Saved_Text]]
Log [[Saved_Text]] ,
IF [[Saved_Text]] == "Thank you"
Log Success
Else
Log Fail
Is that something BAS can do? Ive been trying to do it for the past couple of weeks, and its looking like its not doing it properly. Like i will match it up to the log, and it will still do the else function.
Any help?
Thanks So Much!!
Ofcourse its possible, and its easiest and essential functionality.
The trouble with your example is most likely the very first action
that you are doing - "Get Element Text, [[Saved_Text]]".
Internal bas log will show [[Saved_Text]] variable as "Thank you",
but sometimes that variable might be slightly different, it can contain
an emty line or empty (space) character or multiple of those, and it wont
be visible in internal log.
So you probably have to clean that varible by removing all that
unwanted garbage left from original web page. You can do it with
trim() and other javascript cleaning functions, or do it with BAS cubes
meant for that, which are located under the "String" module as
actions "Trim" and "Clean".
Furthermore, to see how your original string looks like you should
do some temporrary actions, that you can delete from script after
determination. You should save variable [[Saved_Text]] to a TXT file
with "Filesystem" module, action "Write File". Than open that newly
created TXT file and you will see if it has any empty characters or even
empty lines or anything else.
This is just my prediction of what you are facing with. It would be
much easier to help if you posted example script or exact web site
from which you are gathering data.