gettingstarted
[Top] [All Lists]

Re: Creating/Opening a New File??

To: <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Creating/Opening a New File??
From: "B Traver" <btraver at traver dot org>
Date: Wed, 29 Sep 2004 08:59:28 -0400
Delivered-to: gettingstarted at lists dot realsoftware dot com
Importance: Normal
Thanks for the help!  I've tested the following using For I = 1 to 3 and
that worked fine (but see QUESTION below):

  Dim f as FolderItem
  Dim g as FolderItem    
  Dim FileStream as TextOutputStream       
  DIm T as String
  Dim I As Integer
  Dim TheNumber as String 

  g=SelectFolder
  For I = 1 to 730
    TheNumber = str(I)
    f = g.Child(TheNumber  + ".html")
    Filestream = f.CreateTextFile
    
    T = "<html>" + EndOfLine
    T = T + "  <head>" + EndOfLine
    T = T + "  </head>" + EndOfLine
    T = T + "  <body>" + EndOfLine
    T = T + "    <embed src=" + chr(34) + "../MIDI/" +  TheNumber +
".mid" + chr(34) + "" + EndOfLine
    T = T + "    autostart=" + chr(34) + "true" + chr(34) +  EndOfLine
    T = T + "    hidden=" + chr(34) + "false" + chr(34) +  EndOfLine
    T = T + "    loop=" + chr(34) + "false" + chr(34) + ">" + EndOfLine
    T = T + "    <noembed>" + EndOfLine
    T = T + "    <bgsound src=" + chr(34) + "../MIDI/" + TheNumber +
".mid" + chr(34) + EndOfLine
    T = T + "    loop=" + chr(34) + "1" + chr(34) + ">" + EndOfLine
    T = T + "    </noembed></embed>" + EndOfLine
    T = T + "  </body>" + EndOfLine
    T = T + "</html>" + EndOfLine 
    
    Filestream.Write T
    Filestream.close
  Next I
End If

QUESTION:  I do a Dim f as Folderitem outside the loop and then
continually re-use the same f inside the loop.  Is that the recommended
way to do it?

Barry Traver

P.S.  For the curious, what is created in T is HTML that can handle the
competing formats of Microsoft Internet Explorer and Netscape Navigator
for playing MIDI files.  (I hope that it works for other browsers, such
as Safari, as well.)

P.P.S. Believe it or not, Visual Basic is totally lacking a SelectFolder
dialog box (although it has, of course, a SelectFile dialog box).  The
only way you can get a SelectFolder dialog box is through using a
Windows API call.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>