How to Check If Text on Webpage is Found on a .txt file

crisdebourg

Client
Регистрация
14.02.2011
Сообщения
53
Благодарностей
3
Баллы
0
Can anyone suggest how can I check IF a certain (parsed) piece of text on a webpage is found in a .txt file?
I've been struggling to find an answer for 5 hours with no result. Checked the "loop" strategy but I don't understand anything on how to use it. Iamthedarkwiz made a video but I can't understand the logic behind it. Perhaps I'm way too sloww.....

Please give me a helping hand here.

Thanks, you guys!:(
 

crazyflx

Новичок
Регистрация
23.08.2011
Сообщения
19
Благодарностей
8
Баллы
0
I've attached a template & text file to this post. Simply unzip both of them into any folder, then run the template in ZP project maker so you can follow along with each step.

Посмотреть вложение Parsed Text.rar

Here is an explanation of what it is doing:

In the text file, there is your entire original post. The bot will visit this thread, and will parse the following text from your original post "give me a helping hand".

Then it will load the text file (so it can compare the parsed text to the text in the text file). Before it can do that though, it has to make the loaded text file Javascript friendly, as the bot uses Javascript to compare the two and check for a match.

Here is the javascript function it is using to compare the parsed text to the text in the text file:

var WordstoLookFor = "give me a helping hand"; (what actually goes in between those quotes, is the execution result from the page parsing, which is that text)
var WhattoLookIn = "the loaded text file"; (what actually goes in between those quotes, is the execution result from making the loaded text file JS friendly)
WhattoLookIn.search(WordstoLookFor); (this function, returns a positive number when the text is found, and returns -1 when it is not found)

Directly beneath the comparison step, you'll see another step labelled "check if number returned is -1 or not -1. When the comparison step completes, it returns -1 if the text is not found, and returns a positive number if it is found.

So it uses an if "returned number here" is not equal to -1 then do this (text found) else the it returns as false, in which case you say "do this" (text not found).

See this post for a little bit more of an explanation:
http://zennolab.com/discussion/showthread.php?3169-How-to-check-words-in-txt-file&p=18432&viewfull=1#post18432
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Great to see someone with some JS know-how. It's nice to learn to do different things or things in a different way. I personally use regular expression for this but this sounds like a wonderful alternative. Thanks crazyflx.
 
  • Спасибо
Реакции: crazyflx

crazyflx

Новичок
Регистрация
23.08.2011
Сообщения
19
Благодарностей
8
Баллы
0
Great to see someone with some JS know-how. It's nice to learn to do different things or things in a different way. I personally use regular expression for this but this sounds like a wonderful alternative. Thanks crazyflx.
I'll have to keep an eye for your posts then, as it sounds like what you know would compliment what I know nicely...which is a nice way of saying that I know diddly about regex, haha.
 
  • Спасибо
Реакции: crisdebourg

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
Same idea, just different process. Pull text from file, go to a webpage, pull text from page and parse with regex that includes result of step where you pull text from file.

You can also just use the Get=>Webrowser=Get page text step and put the result of the pulling text from file step into the parameters but sometimes it will throw a hiccup.
 

ninny83

Client
Регистрация
10.05.2011
Сообщения
86
Благодарностей
8
Баллы
0
If you have a file with

word 1
word 2
word 3
etc..

You could get a single word from a file (I use counters to get the line number) and then set up reg expr parsing on a web page. Set up logic operation to compare page text and words contained in that file

I don't know if it's a simp,e and quick solution.

Please let me know if you need a template sample

Ciao
 
  • Спасибо
Реакции: bigcajones

crisdebourg

Client
Регистрация
14.02.2011
Сообщения
53
Благодарностей
3
Баллы
0
@crazyflx It worked wonderfully! Thank you! One question: Where can I get such JS scripts like you used for the demo??
 

crazyflx

Новичок
Регистрация
23.08.2011
Сообщения
19
Благодарностей
8
Баллы
0

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)