Page 1 of 1

save RTF in file

Posted: Thu Oct 29, 2015 12:32 am
by WXT
Good day all,
I trying to save RTF in pc file but I cn save my RTF header name but all the time when I open it it empty inside
code

global gEditorField
on preopencard
put "status" into field "statusField"
end preOpenCard

on openCard
put the RTFText of field "editorField" into gEditorField
end openCard

on buttonPushedBack
uploadEditField
end buttonPushedBack

on uploadEditField
if the rtftext of field "editorfield" is gEditorField then
go to card "report"
exit uploadEditField
end if
put field "namefield" into tname
if tname is not in field "listfield" of card"report" then
put "üploading" into field "statusfield"of card "edit report"
put the rtftext of field "editorField"into URL ("file:C:\Users\Live code\Desktop\BPV\report\"& tname & ".rtf")
put cr & tname after field "listfield" of card "report"
put field "listfield" of card "report" into URL ("file:C:\Users\Live code\Desktop\BPV\report\list.txt")
else
put "uploading" into field "statusfield" of card "edit report"
put the rtftext of field "editorField" into url ("file:C:\Users\Live code\Desktop\BPV\report\" & tname & ".rtf")
answer "upload complate"
end if
go to card "report"
end uploadEditField

why it don't save what I write inside the field
thanx

Re: save RTF in file

Posted: Thu Oct 29, 2015 2:28 pm
by Klaus
Hi WXT,

1. welcome to the forum! :D

2. Looks like you discovered a bug!
I also checked this and you are correct, there is a lot of text missing in the resulting file!

I created a bug report:
http://quality.runrev.com/show_bug.cgi?id=16308

EDIT: It just has been confirmed as a bug!


Best

Klaus

Re: save RTF in file

Posted: Thu Oct 29, 2015 8:36 pm
by WXT
thanx for replaying glad to help by accident :)
------
so any help to make it work ?

Re: save RTF in file

Posted: Thu Oct 29, 2015 9:10 pm
by richmond62
I think you are making things very complicated.

Here is a stack that took me 5 minutes.
RTFX.png
RTFX.png (8.05 KiB) Viewed 2742 times
with this script in the button "Export to RTF":

on mouseUp
set the useUnicode to true
ask file "Choose where you wish to export your text"
if the result = "cancel"
then exit mouseUp
else
put the RTFtext of fld "fff" into url("file:" & it & ".rtf")
get the longFilePath of it
set the itemDelimiter to slash
set the defaultFolder to item 1 to -2 of the longFilePath of it
end if
end mouseUp

I have attached the stack so you can play with it.