Page 1 of 2
export field to rtf file
Posted: Mon Sep 20, 2010 9:50 pm
by jmburnod
Hi,
Caramba
I tried
Code: Select all
ask file "Enregistrer sous :" with "notesDev.rtf" -- "notesDev.txt" in the dialog
put "file:"&it into MyURL
put the RTFText of field "notes" into URL myURL
but it dont work
Thank
Jean-Marc
Re: export field to rtf file
Posted: Mon Sep 20, 2010 10:45 pm
by bn
Hi Jean-Marc,
I tried your script on a text field where I had set some text to bold and italic and it was exported allright. This was in Rev 4.0. The file opened in TextEdit with bold and italic preserved.
regards
Bernd
Re: export field to rtf file
Posted: Tue Sep 21, 2010 3:10 am
by shadowslash
jmburnod wrote:Hi,
Caramba
I tried
Code: Select all
ask file "Enregistrer sous :" with "notesDev.rtf" -- "notesDev.txt" in the dialog
put "file:"&it into MyURL
put the RTFText of field "notes" into URL myURL
but it dont work
Thank
Jean-Marc
Hi Jean Marc,
I just tried your script and it seems to be working. Here's a really wild guess, I see on your script that you didn't declare the
MyURL variable. The error might be because you enabled
Strict Compilation in the preferences. You can try unchecking the
Variable Checking from the script editor's
Edit menu.

Re: export field to rtf file
Posted: Tue Sep 21, 2010 8:43 am
by jmburnod
Bernd,
I can't open the rtf file. i have an error when i doubleclic the file "notesDev.rtf" : Le document "notesDev.rtf" n'a pas pu être ouvert
ShadowSlash,
Same result with a "put empty into MyUrl" in first line of the script
Thank
Re: export field to rtf file
Posted: Tue Sep 21, 2010 9:03 am
by shadowslash
jmburnod wrote:ShadowSlash,
Same result with a "put empty into MyUrl" in first line of the script
Hmmm can you answer these questions:
1. What operating system are you running under? If you are not using a Windows environment then please ignore questions
2 and
3.
2. Does the RTF file have a file size greater than 0 byte? You can tell the size by right-clicking it and going to
Properties.
3. Are you perfectly sure you're system isn't infected by a computer virus?
Re: export field to rtf file
Posted: Tue Sep 21, 2010 10:56 am
by Klaus
Hi Jean-Marc,
what happens if you do NOT doubleclick the file but instead use the "Open" menuitem in some text editor like NotePad, Word, TextEdit or whatever?
Re: export field to rtf file
Posted: Tue Sep 21, 2010 11:03 am
by bn
Hi Jean-Marc,
since it works both for Shadowslash and me it might be soemthing in your setup. Since you are on a Mac it may be the filetype/creator, depending on the systemversion I guess. It is worth a try to set that.
You might try
it tells the operating system to use TextEdit and open the file as RTF. Watch out for the space character at the end after RTF. If you set the filetype/creator this way on a Mac you can leave out the file extension .rtf, which I would not recommend, but it works. (It is the old convention on the Mac prior to MacOs X how to identify a file and the associated program. Other than that I have no idea.
By the way on which system version are you trying this?
regards
Bernd
Re: export field to rtf file
Posted: Tue Sep 21, 2010 11:52 am
by Klaus
Hi Jean-Marc,
or you can set the filetype to "" (empty).
This way the OS will be forced to check the suffix in order to open the file with
the app associated with that suffix, which should be TextEdit for RTF files on the mac.
Setting the filetype is a Mac only thing!
Best
Klaus
Re: export field to rtf file
Posted: Tue Sep 21, 2010 10:23 pm
by jmburnod
Hi All
Shadowslash
1. What operating system are you running under? If you are not using a Windows environment then please ignore questions 2 and 3.
2. Does the RTF file have a file size greater than 0 byte? You can tell the size by right-clicking it and going to Properties.
3. Are you perfectly sure you're system isn't infected by a computer virus
1. OSX 10.5.6
2. 8Ko after the Bernd way : set the fileType to "ttxtRTF
3. No
Klaus
what happens if you do NOT doubleclick the file but instead use the "Open" menuitem in some text editor like NotePad, Word, TextEdit or whatever?
Same result
or you can set the filetype to "" (empty).
Same result and the size = 0 ko
Bernd
set the fileType to "ttxtRTF ".
Before (with et the filetype to "" (empty). the size is 0 ko
Thank for help and support
Jean-Marc
Re: export field to rtf file
Posted: Tue Sep 21, 2010 10:37 pm
by bn
Jean-Marc,
I don't get it. Is it working or not. Obviously a file size of 0 is an empty file, is the 8 ko (KB) file working? And if so, I dont understand exactly why. Because Shadowslash's and Klaus's solution should work also.
Anyway, solved or not?
regards
Bernd
Re: export field to rtf file
Posted: Tue Sep 21, 2010 11:28 pm
by jmburnod
Hi Bernd,
No solved
I can't open the file directly or by textedit i have the same error message "le document n'a pas pu être ouvert"
Best
Jean-Marc
Re: export field to rtf file
Posted: Tue Sep 21, 2010 11:55 pm
by bn
Jean-Marc,
could you make a new stack with just a field with some rtf in it and a button for the export. If that does not work for you could you zip it and upload it?
This should work. Something is going on. Could it have to do with permissions? Can you save to the desktop?
regards
Bernd
Re: export field to rtf file
Posted: Wed Sep 22, 2010 8:11 am
by Mark
Hi,
The following script works fine for me on Mac OS X.
Code: Select all
on exportRtf theField,theFile
if there is a field theField then
put the rtfText of fld theField into myRTF
put "\f1 \fs" & (the textSize of char 1 of fld theField)*2 & space & "\" into mySize
replace "\f1 \" with mySize in myRTF
set the filetype to "BOBORTF " -- Claris Works?!
open file theFile for binary write
write myRTF to file theFile
close file theFile
else
beep
end if
end exportRtf
Which operating system do you use, Jean-Marc?
Kind regards,
Mark
Re: export field to rtf file
Posted: Wed Sep 22, 2010 8:28 am
by jmburnod
Hi Mark,
your script work fine for me
I use OSX 10.5.6
also with textEdit with filetype "TTXTRTF "
And one problem solved
Thank at all
Jean-Marc
Re: export field to rtf file
Posted: Wed Sep 22, 2010 12:33 pm
by Klaus
Bonjour Jean-Marc,
jmburnod wrote:...
And one problem solved
...
which is good for you
But Marks script is almost identical to the one you posted first, which worked for others!
So the error must have been somewhere else!
Best
Klaus