Page 1 of 1
Get chars after a find command..
Posted: Thu Apr 25, 2013 10:45 pm
by Fasasoftware
Dear friend,
I need help please...
i need a little script that find a string and then after take some chars on the right of this string...until encounter another string for example "pippo"...
I treyed this script but not work...
Code: Select all
find "minutes" in field"search"
if the foundtext is "minutes" then
put the char 1 to string"pippo" after the foundtext into field"test"
end if
In other words i need to get the chars on the right of a find command until i encounter a string that i want...in this case pippo....(it's an example)...
Thanks a lot in advance
Lestroso

Re: Get chars after a find command..
Posted: Thu Apr 25, 2013 11:39 pm
by Simon
Here you go Lestroso,
Code: Select all
on mouseUp
put wordOffset("minutes", fld 1) into tStart
put wordOffset("pippo", fld 1) into tEnd
answer word tStart to tEnd of fld 1
end mouseUp
Simon
Re: Get chars after a find command..
Posted: Fri Apr 26, 2013 4:00 am
by dunbarx
Lestroso.
You see how compact and robust Simon's script is. You do not need to find anything.
But he wrote in a way that will work with words, not strings. This may be what you intended, given your example, even though you used "string" and "chars" instead of "word".
So if this is the case, you are done. But if not, and you really wanted strings (like "min" and "ppo"), can you make his ideas work for you?
Craig Newman
Re: Get chars after a find command..
Posted: Fri Apr 26, 2013 3:04 pm
by Fasasoftware
thank you Simon thery much!!! you helped me really.....so much!!!
Thanks a lot again....
Lestroso
Re: Get chars after a find command..
Posted: Sat Apr 27, 2013 1:41 am
by Simon
Glad it worked for you!
You should check out wordOffset in the dictionary and figure out the "words to skip". That way if your search terms come up multiple times in a document you can keep track of where you were and then just skip your first find when used in a loop.
Simon
Re: Get chars after a find command..
Posted: Fri Mar 14, 2014 2:54 pm
by atout66
As said Craig Newman, what if you search for a string ?
But if not, and you really wanted strings (like "min" and "ppo"), can you make his ideas work for you?
If I search a string like "<span class="mw-editsection">" the wordOffset() doesn't help.
Even if I write
I also tried with matchChunck() without success...
Re: Get chars after a find command..
Posted: Fri Mar 14, 2014 3:10 pm
by Thierry
atout66 wrote:
If I search a string like "<span class="mw-editsection">" the wordOffset() doesn't help.
Even if I write
I also tried with matchChunck() without success...
Use the quote word to replace the " inside your string.
For matchChunk, put your regex in a custom property or a field
and escape your quotes, like: \"
HTH,
Thierry
Re: Get chars after a find command..
Posted: Fri Mar 14, 2014 4:35 pm
by atout66
I've got it with offset()
Code: Select all
put "API""e&">/" into laChaine
get offset(laChaine,Tsource)
put IT
Thanks

Re: Get chars after a find command..
Posted: Fri Mar 14, 2014 4:53 pm
by Thierry
atout66 wrote:I've got it with offset()
Code: Select all
put "API""e&">/" into laChaine
get offset(laChaine,Tsource)
put IT
Thanks

Elle n'est pas belle, la vie ?
Regards,
Thierry