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


Groups > microsoft.public.scripting.vbscript > #11623 > unrolled thread

WriteLine fails with error 5 (bad argument) on a string ?

Started by"R.Wieser" <address@not.available>
First post2017-04-18 14:14 +0200
Last post2017-04-19 16:46 +0200
Articles 15 on this page of 55 — 4 participants

Back to article view | Back to microsoft.public.scripting.vbscript


Contents

  WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-18 14:14 +0200
    Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-18 09:06 -0400
      Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-18 16:44 +0200
        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-18 18:50 -0400
          Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-19 11:39 +0200
            Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-19 09:22 -0400
              Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-19 17:27 +0200
                Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-19 13:49 -0400
                  Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-20 17:56 +0200
                    Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-20 13:24 -0400
                      Re: WriteLine fails with error 5 (bad argument) on a string ? Ulrich Möller <knobbi38@arcor.de> - 2017-04-21 01:05 +0200
                        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-20 21:42 -0400
                          Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-21 10:11 +0200
                      Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-21 09:23 +0200
    Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-18 09:57 -0400
      Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-18 17:20 +0200
        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-18 14:27 -0400
          Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-18 22:15 +0200
            Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-18 18:30 -0400
              Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-19 11:09 +0200
                Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-19 09:23 -0400
                Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-19 09:59 -0400
                  Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-19 17:41 +0200
      Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-18 11:58 -0400
      Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-26 09:56 -0400
        Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-26 16:35 +0200
          Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-26 10:44 -0400
        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-26 11:07 -0400
        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-26 16:29 -0400
          Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-26 21:26 -0400
            Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-26 23:28 -0400
              Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 01:11 -0400
                Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-28 09:28 -0400
                  Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 15:22 -0400
                    Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-28 19:16 -0400
                      Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:08 -0400
                        Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:11 -0400
                          Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:17 -0400
                        Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:21 -0400
                          Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-28 22:37 -0400
                            Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-29 00:01 -0400
                              Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-29 01:19 -0400
                            Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-29 01:46 -0400
                              Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-29 12:36 -0400
                                Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-29 19:59 -0400
                                  Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-29 20:18 -0400
                          Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 23:50 -0400
                    Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-28 19:29 -0400
                      Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:04 -0400
                        Re: WriteLine fails with error 5 (bad argument) on a string ? "Mayayana" <mayayana@invalid.nospam> - 2017-04-28 22:25 -0400
                          Re: WriteLine fails with error 5 (bad argument) on a string ? GS <gs@v.invalid> - 2017-04-28 22:31 -0400
    Re: WriteLine fails with error 5 (bad argument) on a string ? Ulrich Möller <knobbi38@arcor.de> - 2017-04-18 19:20 +0200
      Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-18 19:58 +0200
        Re: WriteLine fails with error 5 (bad argument) on a string ? Ulrich Möller <knobbi38@arcor.de> - 2017-04-19 14:59 +0200
          Re: WriteLine fails with error 5 (bad argument) on a string ? "R.Wieser" <address@not.available> - 2017-04-19 16:46 +0200

Page 3 of 3 — ← Prev page 1 2 [3]


#11677

FromGS <gs@v.invalid>
Date2017-04-29 00:01 -0400
Message-ID<oe130q$vgg$1@dont-email.me>
In reply to#11675
> "GS" <gs@v.invalid> wrote
>
>> Oops.., spoke too soon. Now I'm getting an empty file again.
>> Back to the drawing board...
>
>   It's always a byte array, but you can also try
> ResponseText. I haven't bothered. I just handle
> a byte array because I get different file types.

Hmm! Didn't see anything exampling ResponseText...
>
> VBA can't do just a basic write, like this?

Not sure because it's downloading a plain text file, not a binary file. Are you 
saying it becomes binary during the process?
>
> FF = FreeFile()
>     Open sPath For Binary As #FF
>         Put #FF, , AFile
>     Close #FF
>
>   I don't see why you'd need to bring in something
> like adodb. My understanding is that's something
> mainly for scripting. Another dependency. 

Yeah, I was wondering about that myself but aborted 'spending' time on it since 
the file created was/is empty.

Anyway, since I found the API to clear the cache I'm going to stick with 
UrlDownloadToFile unless someone shows me 'drop-in' code to download text files 
via WinHttpRequest...<g>

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11678

FromGS <gs@v.invalid>
Date2017-04-29 01:19 -0400
Message-ID<oe17id$97v$1@dont-email.me>
In reply to#11677
>> "GS" <gs@v.invalid> wrote
>>
>>> Oops.., spoke too soon. Now I'm getting an empty file again.
>>> Back to the drawing board...
>>
>>   It's always a byte array, but you can also try
>> ResponseText. I haven't bothered. I just handle
>> a byte array because I get different file types.
>
> Hmm! Didn't see anything exampling ResponseText...
>>
>> VBA can't do just a basic write, like this?
>
> Not sure because it's downloading a plain text file, not a binary file. Are 
> you saying it becomes binary during the process?
>>
>> FF = FreeFile()
>>     Open sPath For Binary As #FF
>>         Put #FF, , AFile
>>     Close #FF
>>
>>   I don't see why you'd need to bring in something
>> like adodb. My understanding is that's something
>> mainly for scripting. Another dependency.
>
> Yeah, I was wondering about that myself but aborted 'spending' time on it 
> since the file created was/is empty.
>
> Anyway, since I found the API to clear the cache I'm going to stick with 
> UrlDownloadToFile unless someone shows me 'drop-in' code to download text 
> files via WinHttpRequest...<g>

Found a function (2 actually) that return the file contents using 
WinHttpRequest and passing URL,FullFilename as args. Not as lengthy<g> as your 
sample, but serves as a drop-in wrapper that gets the job done. I just write 
the return to file using normal VB file i/o!

Thanks again for your most appreciated efforts in helping me get this worked 
out!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11679

FromGS <gs@v.invalid>
Date2017-04-29 01:46 -0400
Message-ID<oe1956$clq$1@dont-email.me>
In reply to#11675
> "GS" <gs@v.invalid> wrote
>
>> Oops.., spoke too soon. Now I'm getting an empty file again.
>> Back to the drawing board...
>
>   It's always a byte array, but you can also try
> ResponseText. I haven't bothered. I just handle
> a byte array because I get different file types.
>
> VBA can't do just a basic write, like this?
>
> FF = FreeFile()
>     Open sPath For Binary As #FF
>         Put #FF, , AFile
>     Close #FF
>
>   I don't see why you'd need to bring in something
> like adodb. My understanding is that's something
> mainly for scripting. Another dependency. 

Ok, I was able to tweak things out so the WinHttpRequest code is...

<snip>
  Set oWHR = CreateObject("WinHttp.WinHttpRequest.5.1")
  oWHR.Open "POST", sSrcFile, False
  oWHR.Send

  If oWHR.Status = 200 Then
    WriteTextFile oWHR.ResponseText, sTgtFile
  End If
</snip>

..which obviates needing the wrapper function. Note that including the version 
supports features not included in earlier versions. Note also that I change the 
method arg to "POST" instead of "GET" just to see what happens; -both work but 
I'll revert to using "GET" anyway.

Now I can have it both ways and not have files left in the cache!<bg>

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11680

FromGS <gs@v.invalid>
Date2017-04-29 12:36 -0400
Message-ID<oe2f7t$ut7$1@dont-email.me>
In reply to#11679
Tweaking further.., since all I need is to dump .ResponseText directly into my 
array for processing the data. This means I can dispense with writing to file 
just to read back into my array. IMO, that's a lot cleaner method than 
UrlDownloadToFile...

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11681

From"Mayayana" <mayayana@invalid.nospam>
Date2017-04-29 19:59 -0400
Message-ID<oe398e$d31$1@dont-email.me>
In reply to#11680
"GS" <gs@v.invalid> wrote

| Tweaking further.., since all I need is to dump .ResponseText directly 
into my
| array for processing the data. This means I can dispense with writing to 
file
| just to read back into my array. IMO, that's a lot cleaner method than
| UrlDownloadToFile...
|

  It sounds like you're all set. Winhttp allows for lots
of functionality and does it easily, but since you
don't need any of that, there's no reason not to just
do it in a few lines. It's very easy and avoids all that
tacky, privacy infringing IE wrapper stuff.

  It's surprising how many people don't know about
the wininet/IE tie-in. I got into a debate about it once
with Deanna in the VB group. From all indications she's
a more experienced programmer than I'll ever be, yet
she insisted that IE cache is windows cache, IE cookies
are Windows cookies and wininet is the Windows
Internet library. She works in low level C++ yet couldn't
see using anything but an IE wrapper to download files.
It was bizarre. No one would think it normal to call
UrlDownloadTofile and end up setting Firefox cookies.
But commercial programmers in "Windows shops" have
been trained to conflate IE and Internet through years
of "thought leadership" from Microsoft. 

[toc] | [prev] | [next] | [standalone]


#11682

FromGS <gs@v.invalid>
Date2017-04-29 20:18 -0400
Message-ID<oe3aak$fih$1@dont-email.me>
In reply to#11681
> "GS" <gs@v.invalid> wrote
>
>> Tweaking further.., since all I need is to dump .ResponseText directly  into 
>> my array for processing the data. This means I can dispense with writing to  
>> file just to read back into my array. IMO, that's a lot cleaner method than
>> UrlDownloadToFile...
>> 
>
>   It sounds like you're all set. Winhttp allows for lots
> of functionality and does it easily, but since you
> don't need any of that, there's no reason not to just
> do it in a few lines. It's very easy and avoids all that
> tacky, privacy infringing IE wrapper stuff.
>
>   It's surprising how many people don't know about
> the wininet/IE tie-in. I got into a debate about it once
> with Deanna in the VB group. From all indications she's
> a more experienced programmer than I'll ever be, yet
> she insisted that IE cache is windows cache, IE cookies
> are Windows cookies and wininet is the Windows
> Internet library. She works in low level C++ yet couldn't
> see using anything but an IE wrapper to download files.
> It was bizarre. No one would think it normal to call
> UrlDownloadTofile and end up setting Firefox cookies.
> But commercial programmers in "Windows shops" have
> been trained to conflate IE and Internet through years
> of "thought leadership" from Microsoft. 

Yeah, I recall following that debate! Don't know much about her but I get the 
impression she's 'top level' in programming. Relatively speaking, since my 
background is primarily Excel VBA, I consider myself a 'hack novice' VB 
programmer. I don't have a clue where I'd be today if it wasn't for all the 
help I've received in these NGs!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11676

FromGS <gs@v.invalid>
Date2017-04-28 23:50 -0400
Message-ID<oe12d1$u7s$1@dont-email.me>
In reply to#11672
Meanwhile, this API function solves the issue of update calls reading from 
cache...

  DeleteUrlCacheEntry()

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11667

From"Mayayana" <mayayana@invalid.nospam>
Date2017-04-28 19:29 -0400
Message-ID<oe0j3u$2kd$1@dont-email.me>
In reply to#11665
"GS" <gs@v.invalid> wrote
| BTW:
| I continued looking into using php for form processing to a text file 
AFTER I
| left you a contact msg on your website. That's working very well now nd so 
my
| focus is on download/read an online file. Here's what I'm using with
| WinHttpRequest.5.1...
|

   Today you sent a message? I didn't get it.
Did you send it from non-freebie webmail?
Anything like gmail, yahoo, hotmail is auto-deleted. 

[toc] | [prev] | [next] | [standalone]


#11668

FromGS <gs@v.invalid>
Date2017-04-28 22:04 -0400
Message-ID<oe0s5j$ndj$1@dont-email.me>
In reply to#11667
> "GS" <gs@v.invalid> wrote
>> BTW:
>> I continued looking into using php for form processing to a text file  AFTER 
>> I left you a contact msg on your website. That's working very well now nd so 
>>  my focus is on download/read an online file. Here's what I'm using with
>> WinHttpRequest.5.1...
>> 
>
>    Today you sent a message? I didn't get it.
> Did you send it from non-freebie webmail?
> Anything like gmail, yahoo, hotmail is auto-deleted. 

Not today. It was last week via the contact form on your website!

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11673

From"Mayayana" <mayayana@invalid.nospam>
Date2017-04-28 22:25 -0400
Message-ID<oe0te6$rb8$1@dont-email.me>
In reply to#11668
"GS" <gs@v.invalid> wrote

| Not today. It was last week via the contact form on your website!
|
    Hmm. I do tend to get one or two spam per day
from companies that want to sell me website help.
They typically have subjects like Help or Info. I delete
those. I'm sorry if I missed yours. I just tested it and
it's working fine. So accidentally deleting your email
is the only thing I can think of.

   It sounds like you don't still need PHP help but I
would say that I'm no expert. I figure out what I
need to. Mostly I've just needed to do includes in
order to serve different pages to IE vs other
browsers. Other than that I've never needed much
in terms of server-side functionality. 

[toc] | [prev] | [next] | [standalone]


#11674

FromGS <gs@v.invalid>
Date2017-04-28 22:31 -0400
Message-ID<oe0toe$s2b$1@dont-email.me>
In reply to#11673
> "GS" <gs@v.invalid> wrote
>
>> Not today. It was last week via the contact form on your website!
>> 
>     Hmm. I do tend to get one or two spam per day
> from companies that want to sell me website help.
> They typically have subjects like Help or Info. I delete
> those. I'm sorry if I missed yours. I just tested it and
> it's working fine. So accidentally deleting your email
> is the only thing I can think of.
>
>    It sounds like you don't still need PHP help but I
> would say that I'm no expert. I figure out what I
> need to. Mostly I've just needed to do includes in
> order to serve different pages to IE vs other
> browsers. Other than that I've never needed much
> in terms of server-side functionality. 

PHP is new to me but wasn't hard to figure out after a visit to the W3School 
online tutorials. I've only ever processed form results into emails via 
formmail.pl...

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

[toc] | [prev] | [next] | [standalone]


#11629

FromUlrich Möller <knobbi38@arcor.de>
Date2017-04-18 19:20 +0200
Message-ID<od5hl3$a2e$1@dont-email.me>
In reply to#11623
Hi Rudy,

Am 18.04.2017 um 14:14 schrieb R.Wieser:
> Bonus question (for when the first is impossible): How do I convert a string
> into one I can actually write to a file WITHOUT having to go thru it
> byte-by-byte (copy the aceptable ones into a new string and write that one)
> ?   I've already tried CStr and Trim, but neither are helpfull.:-\
here are some examples to accomplish this:
http://www.motobit.com/tips/detpg_binarytostring/

Maybe you can use responeXML instead of responseText of the XMLHTTP 
object in your project.
See https://msdn.microsoft.com/en-us/library/ms762275(v=vs.85).aspx 
<https://msdn.microsoft.com/en-us/library/ms762275%28v=vs.85%29.aspx>(section 
remarks) for some hints.

Another interesting object is the ado.stream object. I sometimes uses it 
for decoding charsets from utf-8 to unicode.

Ulrich

[toc] | [prev] | [next] | [standalone]


#11630

From"R.Wieser" <address@not.available>
Date2017-04-18 19:58 +0200
Message-ID<58f653a0$0$838$e4fe514c@news.xs4all.nl>
In reply to#11629
Ulrich,

> here are some examples to accomplish this:

Thanks for the examples, but those only work when you can load a file
containing multi-byte chars in as plain ASCII (and thereby getting access to
every byte of a multi-byte sequence seperatily).   In my case thats not
applicable (I already have the string, and can't change its ASCII- or
Unicode-ness).

> Maybe you can use responeXML instead of responseText of the
> XMLHTTP object in your project.

Sorry, nope. The object throws an error when I try to use that method.

> Another interesting object is the ado.stream object. I sometimes
> uses it for decoding charsets from utf-8 to unicode.

I need to go the other way*, but it could not hurt to take a look it.

*actually, I only need to be able to negate VBScripts everything-to-unicode
translation, and get the (presumed to be MultiByte) origional back and than
into the file.

Regards,
Rudy Wieser


-- Origional message:
Ulrich Möller <knobbi38@arcor.de> schreef in berichtnieuws
od5hl3$a2e$1@dont-email.me...
> Hi Rudy,
>
> Am 18.04.2017 um 14:14 schrieb R.Wieser:
> > Bonus question (for when the first is impossible): How do I convert a
string
> > into one I can actually write to a file WITHOUT having to go thru it
> > byte-by-byte (copy the aceptable ones into a new string and write that
one)
> > ?   I've already tried CStr and Trim, but neither are helpfull.:-\
> here are some examples to accomplish this:
> http://www.motobit.com/tips/detpg_binarytostring/
>
> Maybe you can use responeXML instead of responseText of the XMLHTTP
> object in your project.
> See https://msdn.microsoft.com/en-us/library/ms762275(v=vs.85).aspx
>
<https://msdn.microsoft.com/en-us/library/ms762275%28v=vs.85%29.aspx>(sectio
n
> remarks) for some hints.
>
> Another interesting object is the ado.stream object. I sometimes uses it
> for decoding charsets from utf-8 to unicode.
>
> Ulrich
>
>

[toc] | [prev] | [next] | [standalone]


#11637

FromUlrich Möller <knobbi38@arcor.de>
Date2017-04-19 14:59 +0200
Message-ID<od7moa$d9e$1@dont-email.me>
In reply to#11630
Hi Rudy

Am 18.04.2017 um 19:58 schrieb R.Wieser:
>> Another interesting object is the ado.stream object. I sometimes
>> uses it for decoding charsets from utf-8 to unicode.
> I need to go the other way*, but it could not hurt to take a look it.
>
> *actually, I only need to be able to negate VBScripts everything-to-unicode
> translation, and get the (presumed to be MultiByte) origional back and than
> into the file.
Normally vbscript handles a string as pure binary data. Assignments to 
other vars are handled transparently. The problem occurs, when you try 
to modify the string.

So to write this string transparently into a file simple use the 
ado.stream object. Instantiate the object, set the type to binary and 
write the string into the stream. Then you will be able to write the 
stream content to a file with the ado.stream object.

Btw, if you want to pick some bytes from the string, you can use the 
MidB function to extract a data byte from a string.

Ulrich

[toc] | [prev] | [next] | [standalone]


#11641

From"R.Wieser" <address@not.available>
Date2017-04-19 16:46 +0200
Message-ID<58f777f5$0$760$e4fe514c@news.xs4all.nl>
In reply to#11637
Ulrich,

> Normally vbscript handles a string as pure binary data.

Thats not what I know about VBScript (or the environment it runs in).   Try
to find a Variant type which will be able to hold a binary and/or ASCII
string.   I think you will be hard-pressed.

> So to write this string transparently into a file simple use the
> ado.stream object.

Multiple problems "ado.stream" seems to be a rather elusive google search
term

The line "set oStream = new stream" throws an error: object not found (did I
already mention the 'puter is oldish ?)

But if its so simple, whats than wrong with using the
Scripting.FileSystemObject objects CreateTextFile ?

> set the type to binary and write the string into the stream.

How would that be different than writing the string to a file of the type
ASCII ?

> Btw, if you want to pick some bytes from the string, you can use
> the MidB function to extract a data byte from a string.

You obviously haven't read shit about the stuff I've alread posted (in
response to Mayayana).   I have absolutily *zero* wish to got to thru the
whole shebang again.  Go pester someone else please.

Regards,
Rudy Wieser




Ulrich Möller <knobbi38@arcor.de> schreef in berichtnieuws
od7moa$d9e$1@dont-email.me...
> Hi Rudy
>
> Am 18.04.2017 um 19:58 schrieb R.Wieser:
> >> Another interesting object is the ado.stream object. I sometimes
> >> uses it for decoding charsets from utf-8 to unicode.
> > I need to go the other way*, but it could not hurt to take a look it.
> >
> > *actually, I only need to be able to negate VBScripts
everything-to-unicode
> > translation, and get the (presumed to be MultiByte) origional back and
than
> > into the file.
>
> Normally vbscript handles a string as pure binary data. Assignments to
> other vars are handled transparently. The problem occurs, when you try
> to modify the string.
>
> So to write this string transparently into a file simple use the
> ado.stream object. Instantiate the object, set the type to binary and
> write the string into the stream. Then you will be able to write the
> stream content to a file with the ado.stream object.
>
> Btw, if you want to pick some bytes from the string, you can use the
> MidB function to extract a data byte from a string.
>
> Ulrich
>

[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | microsoft.public.scripting.vbscript


csiph-web