Búsquedas de texto en director

Necesito hacer que me busque las palabras que le ponga yo, y me las marque de alguna manera, hilite, etc..
He encontrado alguna forma de hacerlo, viene un ejemplo con el programa (text.dir), peeeero.. Ese ejemplo solo marca palabras sueltas, y solo la primera coincidencia que encuentra. Necesito que me marque todas las palabras, ya estén en cadena o desperdigadas por el texto.

3 Respuestas

Respuesta

Ring the article, and more importantly, your personal experience mindfully using our emotions as data about our inner state and knowing when it’s better to de-escalate by taking a time out are great tools. Appr https://mxplayer.pro/ eciate you reading and shari

Respuesta
1
En el mismo ejemplo que mencionas (text.dir), reemplaza en el script "search script" lo siguiente.
-- look for word
encontrados=FALSE
repeat with wordIndex = 1 to gBeeTextMember.word.count
-- if we have a match set the forecolor of the word and exit the handler
if (gBeeTextMember.word[wordIndex] = searchWord) or (gBeeTextMember.word[wordIndex] = searchWord & ".") then
gBeeTextMember.word[wordIndex].foreColor = 188
encontrados=NOT(encontrados)
--exit
end if
end repeat
-- if we get this far in the handler we haven't found the word so
-- reset the foreColor and alert the user
if encontrados=TRUE then
gBeeTextMember.foreColor = gCurrentTextColor
alert "The word " & QUOTE & searchWord & QUOTE & " cannot be found in the text"
end if
Lo que hice es eliminar el exit en del if y agregar una condición al final.
Revisa los cambios y verás que ahora marca todas las coincidencias de la palabra buscada.
Respuesta
1
Supongamos que nuestra búsqueda es la palabra "hola" :
repeat with i=1 to texto.length
if texto=busqueda[1] then
repeat with j=i+1 to busqueda.length
ok=1
if texto[j]=busqueda[j-i+1] then ok=ok+1
end repeat
if ok=busqueda.length then
texto.char[i..i+busqueda.length-1].hilite=true
i=i+busqueda.length-1
end if
end if
end repeat
"texto" es en el texto en el que quieres buscar.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas