LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Mon Sep 20, 2010 9:50 pm
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
https://alternatic.ch
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Mon Sep 20, 2010 10:45 pm
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
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Tue Sep 21, 2010 3:10 am
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.

Parañaque, Philippines

-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Sep 21, 2010 8:43 am
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
https://alternatic.ch
-
shadowslash
- Posts: 344
- Joined: Tue Feb 24, 2009 6:14 pm
-
Contact:
Post
by shadowslash » Tue Sep 21, 2010 9:03 am
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?
Parañaque, Philippines

-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Tue Sep 21, 2010 10:56 am
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?
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue Sep 21, 2010 11:03 am
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
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Tue Sep 21, 2010 11:52 am
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
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Sep 21, 2010 10:23 pm
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
https://alternatic.ch
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue Sep 21, 2010 10:37 pm
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
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Tue Sep 21, 2010 11:28 pm
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
https://alternatic.ch
-
bn
- VIP Livecode Opensource Backer

- Posts: 4163
- Joined: Sun Jan 07, 2007 9:12 pm
Post
by bn » Tue Sep 21, 2010 11:55 pm
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
-
Mark
- Livecode Opensource Backer

- Posts: 5150
- Joined: Thu Feb 23, 2006 9:24 pm
-
Contact:
Post
by Mark » Wed Sep 22, 2010 8:11 am
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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
-
jmburnod
- VIP Livecode Opensource Backer

- Posts: 2729
- Joined: Sat Dec 22, 2007 5:35 pm
-
Contact:
Post
by jmburnod » Wed Sep 22, 2010 8:28 am
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
https://alternatic.ch
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Sep 22, 2010 12:33 pm
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