Page 1 of 1

How to select Chars after command wordoffset ???

Posted: Thu Jan 17, 2013 2:23 pm
by Fasasoftware
Dear friend,
How i can select Chars after command wordoffset ??? i need to select a portion of chars using for example "select char 1 to 37 after the foundtext"...but i can't go on don't work...do you have any idea??? Here below there's a little idea of script...can you help me?'please??
Thanks
lestroso :oops:

Code: Select all


On mouseUp
   PUT URL "http://www.runrev.com" INTO FIELD 1
  
      put wordoffset("today", fld 1 ) into tOffW
    
      select WORD tOffW +1  of fld 1
   --This return "Millions" ok!!
   --I want here take after the selection of "Millions" the other for example 1 to 37 chars and put it into a field...
   ----Any idea???

end mouseUp


Re: How to select Chars after command wordoffset ???

Posted: Thu Jan 17, 2013 2:43 pm
by Klaus
Buongiorno Lestroso,

you need to do this in 3 steps:
1. Get the WORDOFFSET for the desired WORD like "Today" in your example
2. Calculate the number of characters for word 1 to WORDOFFSET
3. Take this to calculate the following X characters.

To use your excample to select 37 characters AFTER the found word:

Code: Select all

on mouseUp
  PUT URL "http://www.runrev.com" into fld 1
  put wordoffset("Today",fld 1 ) into tOffW
  
  ## Calculate the num of characters from word 1 to the found word:
  put the num of chars of word 1 to tOffW of fld 1 into tCharOffset
  
  ## tCharOffSet is the number of the last character of the found word with WORDOFFSET
  ## Add 2 to start with the FIRST character of the next WORD
  add 2 to tCharOffSet
  ## or do NOT add 2 to also select the SPACE after the found word!
  
  ## Now you can start from this value to selecte any  number of characters AFTER the found word:
  select char tCharOffSet to tCharOffSet + 37 of fld 1
end mouseUp
Best

Klaus

Re: How to select Chars after command wordoffset ???

Posted: Thu Jan 17, 2013 3:10 pm
by Fasasoftware
Thank you a lot and very much Klaus!!!!!!

You have solved my big problem!!!! You're the best Livecode Programmer!!!

Thank you again for your fast answer.....

Cheers!!

Yours faithfully,

Lestroso :D :D :D :D :D

Re: How to select Chars after command wordoffset ???

Posted: Thu Jan 17, 2013 6:28 pm
by Klaus
8)