There are multiple different options depending on what you want to do
with the data in the files.

If you just want to discard any graphical information and then use the
file with other tools, then this function will do that:

#lang racket
(require wxme)
(provide
 (contract-out
  [textify (-> path-string? path-string? void?)]))
(define (textify in out)
  (call-with-input-file in
    (λ (in-port)
      (call-with-output-file out
        (λ (out-port)
          (copy-port (wxme-port->text-port in-port) out-port))
        #:exists 'truncate))))


At the other end of the spectrum, you can open a text% object and load
the file into it. Then you use text% methods to inspect the content of
the file as real graphical things (this will let you do things like
inspect the contents of comment boxes, as they will have nested text%
objects, etc etc).

In the middle are functions that are like the one above but use
wxme-port->port. This, via "specials" gives you access to the non text
data in a stream format that might work better for some tasks.

hth,
Robby


On Sun, Sep 13, 2015 at 7:27 PM, Andre Mayers <andre.mayer...@gmail.com> wrote:
> I think the answer is no.
> I may not know how to use the procedure in wxme library.
>
> The file that I have are racket code file.
> They begin by the following line
>
>         #reader(lib"read.ss""wxme")WXME0108 ##
>         #|
>          This file uses the GRacket editor format.
>           Open this file in DrRacket version 6.2.1 or later to read it.
>         ...
>
> The following lines
>         (define rkt-port (open-input-file "test-no1-file.rkt"))
>         (wxme-read rkt-port)
> return
> --> insert-file in text%: not a WXME file
>
>
>
> -----Message d'origine-----
> De : racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] De 
> la part de Neil Van Dyke
> Envoyé : 13 septembre 2015 15:51
> À : André Mayers <andre.may...@usherbrooke.ca>; racket-users@googlegroups.com
> Objet : Re: [racket-users] Procedure to save racket file as text file
>
> Is this what you need?  (I'm not sure.)
> http://docs.racket-lang.org/gui/WXME_Decoding.html
>
>
> André Mayers wrote on 09/13/2015 03:44 PM:
>> I need a procedure to save the content of many racket files (*.rkt) in  text 
>> files (*.txt).
>> I know, I can use the "save as" button in drRacket but it will take too much 
>> time.
>> Obviously, I am ready to strip all the graphic content in the conversion 
>> process.
>> Any hint, on how I can do it will be appreciated.
>>
>> Thanks,
>>
>> André Mayers,
>> http://info.usherbrooke.ca/AndreMayers
>>
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to