Page 1 of 1

Copy a string to a specific line in a fld (UTF8 safe)[Solved

Posted: Thu Apr 14, 2016 9:54 am
by atout66
Hi to all,

My question is: How can I copy a string to a specific line in an other field ?
For example my script below can copy a specific line from the fld "laDefinition" but what to do if I want this line to by copied to line 3 of fld "laCible" ?

Code: Select all

copy line 4 of fld "laDefinition"
     focus on nothing
     focus on fld "laCible"
     if the clipboard is "text" then paste
Thanks in advance for your help, Jean-Paul.

Re: Copy a string to a specific line in a fld

Posted: Thu Apr 14, 2016 10:47 am
by AxWald
Hi,

try:

Code: Select all

put 23 into myLiNum
put line 4 of fld "laDefinition" into line myLiNum of fld "laCible"
;-) Have fun!

Re: Copy a string to a specific line in a fld

Posted: Thu Apr 14, 2016 11:04 am
by atout66
Thanks AxWald, but it would be too simple like that :wink:

If I want to copy instead of to put one line of a fld to an other it's because the copy method preserves the unicode chars from one field to the other :!:

Re: Copy a string to a specific line in a fld

Posted: Thu Apr 14, 2016 11:42 am
by MaxV
Do you like this?

Code: Select all

put line 4 of fld "laDefinition" into temp1
put line 1 to 3 of field "laCible" into temp2
put line 4 to -1 of field "laCible" into temp3
put temp2 & temp1 & return & temp3 into field "laCible"

Re: Copy a string to a specific line in a fld

Posted: Thu Apr 14, 2016 11:58 am
by atout66
Yes I like it but it doesn't change the probleme :?
Let say for example you have this string below in a line of a field:

Code: Select all

blablabla şişkebap blablabla blablabla 
Now, try to do your method and you'll notice that you loose the char 1 and 3 of the word 2 which use UTF8 chars...

If you use the copy function instead, you keep all the chars as they are.
So as mentionned in my first post, I can copy a specific line of a field to an other field, but what to do to paste in a special line into the new field ?
"That is the question" like said someone before :wink:

Re: Copy a string to a specific line in a fld (UTF8 safe)

Posted: Thu Apr 14, 2016 2:12 pm
by AxWald
Oooops,

missed the unicode thingie!

Doesn't matter, try this then:

Code: Select all

set the unicodetext of line 1 of fld "b" to the unicodetext of line 1 of fld "a"
:D

Have fun!

PS: Didn't get any method working with using the clipboard ...

Re: Copy a string to a specific line in a fld (UTF8 safe)

Posted: Thu Apr 14, 2016 2:39 pm
by atout66
You've got it :D
Thanks a lot, lot lot and more :wink:
That's exactlly what I've been looking for since a while now.

Re: Copy a string to a specific line in a fld

Posted: Thu Apr 14, 2016 2:47 pm
by MaxV
atout66 wrote:Yes I like it but it doesn't change the probleme :?
Let say for example you have this string below in a line of a field:

Code: Select all

blablabla şişkebap blablabla blablabla 
Now, try to do your method and you'll notice that you loose the char 1 and 3 of the word 2 which use UTF8 chars...
I don't loose any chars on windows. :?:
Livecode 7 supports unicode natively, so I don't need to use any other commands.