[plt-scheme] Converting from DrScheme multimedia format to text

From: John Clements (clements at brinckerhoff.org)
Date: Thu Sep 23 11:18:30 EDT 2004

On Sep 22, 2004, at 4:09 PM, Allyn Dimock wrote:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
> Is there a standalone mzscheme script to
> (1) detect if a file is in DrScheme multimedia format
>   and if so
> (2) convert it to text format
>
> Such a script would be useful to automate some simple grading tasks in
> courses using DrScheme as a development environment.
>
> If no such script exists, could someone point me to the correct part
> of the DrScheme source code to steal code to develop such a script.

Well, it's not a MzScheme script, it's a MrEd script, but you can run 
it in pretty much the same way.
Here's how to do it:

save-as-text.ss:

(unless (= (vector-length argv) 2)
   (error 'graphical-to-text "usage: <executable> <input-filename> 
<output-filename>"))

(define in-filename (vector-ref argv 0))
(define out-filename (vector-ref argv 1))

(define t (new text%))
(send t load-file in-filename)
(define f (new frame% (label "") (width 500) (height 500)))
(define ec (new editor-canvas% (parent f) (editor t)))
(send t save-file out-filename 'text)


Invoke it like this:

mred -fv save-as-text.ss <input-file> <output-file>



BTW, this code essentially comes direct from Robby, but I never 
bothered to put it together into a single script.  Would this sort of 
thing belong in the Cookbook, or is this too PLT-specific?

john

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2169 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20040923/17182310/attachment.p7s>

Posted on the users mailing list.