Code:
import dbg, app, chat
szText = self.GetText()
#szText_ = self.inputValue.GetText() ## your input value
try:
szGetFile = app.OpenTextFile("locale/en/block_words_python.txt")
count_words = app.GetTextFileLineCount(szGetFile)
except IOError:
dbg.LogBox("Error: Loading words !")
app.Abort()
for vegas in xrange(count_words):
lineText = app.GetTextFileLine(szGetFile, vegas)
szGetTextFromFile = str(lineText).split("\t")
if len(szGetTextFromFile) == 0 or not szGetTextFromFile[0]:
continue
if szText == szGetTextFromFile[0]:
chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Blocked words were introduced!")
return
#if szText == szGetTextFromFile[0] and szText.find("b") != -1:
#chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Check Function Test 1!")
#return
#iText = szGetTextFromFile[0]
#if text and iText.find(" ") != -1:
#if szGetTextFromFile[0] and text.find("a"):
#if iText.strip().split(" ")[1] == text[-1:]:
#test = self.GetText()
#if szGetTextFromFile[0]:
#if test.find(" "):
#szText = szText.replace(" ", "____")
#chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Check Function Test 2!")
#return
#if szText.find("vegas") != -1:
#iText = str(iText).replace(" ", "pythonX")
Code:
text0 text1 text2 text3 text4 text5 text6 text7 text8 text9 text10 text11 text12 text13 text14 text15
-------------------------
Method 2 (xP3NG3Rx):
Code:
import app, chat
szText = "banword"
fHandle = app.OpenTextFile("locale/en/block_words_python.txt")
if not fHandle:
return False
if szText in [app.GetTextFileLine(fHandle, i).strip() for i in xrange(app.GetTextFileLineCount(fHandle))]
chat.AppendChat(chat.CHAT_TYPE_INFO, "[SYSTEM] Blocked words were introduced!")
return







