Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12104

Textstream Write

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Textstream Write
Date 2019-04-29 08:55 -0400
Organization A noiseless patient Spider
Message-ID <qa6scj$rb4$1@dont-email.me> (permalink)

Show all headers | View raw


  Very weird problem. I've been working on an HTA that
allows me to touch-up edit webpages, in WYSIWYG manner.
It starts by loading what's in the BODY into a DIV, then
storing the header and end. When I save changes it takes
the innerHTML from the DIV, adds back the header and end,
and writes to disk with normal Textstream operation.

   The whole thing works fine but I was testing it on various
files and came across one (an article from theregister.co.uk
that has no particular odd qualities) that won't work.

  I load the page fine but saving changes results in a blank file.
Empty. If I show the 3 parts in msgbox they all look right. If
I right each part to disk, the BODY section is empty but both
ends write OK. When I write the whole file it writes the blank
file and then errors with "invalid procedure call or argument".
That seems to be at Write, though I'm not certain because error
line numbers can be off. The code is in an external VBS.

  sMid = MainDiv.innerHTML
  sContent = sBeg & sMid & sEnd

Then it calls the Write routine in a class. All very vanilla:

Public Sub WriteFile(sPath, sContent)
 'on error resume next
    If FSOcc.FileExists(sPath) = True Then FSOcc.DeleteFile sPath, True
  Set TScc = FSOcc.CreateTextFile(sPath, True)
    TScc.Write sContent
    TScc.Close
  Set TScc = Nothing
End Sub

  The only thing I can even imagine causing trouble would
be a null, but I don't see how a null could get into the text.
Even then, the file should write up to the null. And this happens
even if I've made no edits to the page content. (Though IE
does make edits.) I've also tried removing script before loading.
Nothing works. It always comes out a zero length file.

Here's the webpage, for what it's worth:
https://www.theregister.co.uk/2019/04/26/windows_10_storage/

I just picked it randomly, downloading only the HTML.

Back to microsoft.public.scripting.vbscript | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-29 08:55 -0400
  Re: Textstream Write JJ <jj4public@vfemail.net> - 2019-04-30 17:45 +0700
    Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 13:21 +0200
  Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 08:51 -0400
    Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 18:22 +0200
      Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 13:01 -0400
        Re: Textstream Write "R.Wieser" <address@not.available> - 2019-04-30 21:37 +0200
          Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-04-30 17:06 -0400
            Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 10:01 +0200
              Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-01 08:37 -0400
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 16:00 +0200
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 16:12 +0200
                Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-01 10:47 -0400
                Re: Textstream Write "R.Wieser" <address@not.available> - 2019-05-01 19:09 +0200
  Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-04 15:26 -0400
    Re: Textstream Write JJ <jj4public@vfemail.net> - 2019-05-05 20:15 +0700
      Re: Textstream Write "Mayayana" <mayayana@invalid.nospam> - 2019-05-05 10:19 -0400

csiph-web