Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

once again VBscript SUCKS

122 views
Skip to first unread message

Rahul Verma

unread,
Jan 17, 2003, 2:09:13 AM1/17/03
to
I am create a txt file from one script and reading from other script and
writing in some other file , I don't know what is happening


PLEASE HELP

======== script 1 ==================
set fso=createobject("scripting.filesystemobject")
set file=fso.createtextfile("file1.txt",2,true)

for i =1 to 10

file.writeline("this is line no "&i)
next

file.close
========script 2====================

set fso=createobject("scripting.filesystemobject")
set file=fso.opentextfile("file1.txt",1)

set fso1=createobject("scripting.filesystemobject")
set file1=fso.createtextfile("file2.txt",2,true)

while not file.atendofstream

str=file.readline
wscript.echo str
file1.writeline(str)

wend

file.close
file1.close
===============================


Steve Fulton

unread,
Jan 17, 2003, 7:26:31 AM1/17/03
to

It looks like you meant to use OpenTextFile with ForWriting (2) as the iomode,
with the create option enabled, in (default) ASCII mode. Instead you used
CreateTextFile with the overwrite option specified (2 is coerced to boolean
true) in Unicode mode. Then you read the Unicode file in ASCII mode and write it
out in Unicode again!

CreateTextFile Method
http://msdn.microsoft.com/library/en-us/script56/html/jsmthcreatetextfile.asp

OpenTextFile Method
http://msdn.microsoft.com/library/en-us/script56/html/jsmthopentextfile.asp

Windows Script Documentation
http://msdn.microsoft.com/downloads/sample.asp?url=/MSDN-FILES/027/001/728/msdncompositedoc.xml

--
Steve

Being defeated is often a temporary condition. Giving up is what makes it
permanent. -Marilyn vos Savant


Janne Saarinen

unread,
Jan 17, 2003, 11:36:37 AM1/17/03
to
Very stupid to say its scripting lang problem if dont have _know how_ enough
to use it.
Every languages have own "weirdo" things or "not so common things".

"Rahul Verma" <raul...@hotmail.com> wrote in message
news:t_NV9.2703$IZ5....@nwrddc04.gnilink.net...

Rahul Verma

unread,
Jan 17, 2003, 11:58:46 AM1/17/03
to
It's very true :)

but VBscript still sucks in front of PERL
"Janne Saarinen" <janne.s...@disnet.fi> wrote in message
news:b09bd2$39q$1...@nyytiset.pp.htv.fi...

Curtis Anderson

unread,
Jan 17, 2003, 12:11:13 PM1/17/03
to
Rahul Verma <raul...@hotmail.com> uttered:

> It's very true :)
>
> but VBscript still sucks in front of PERL

Yes, but what doesn't? ;-)


Alex K. Angelopoulos (MVP)

unread,
Jan 17, 2003, 12:31:22 PM1/17/03
to
Yeah. I could do that with two punctuation marks and a squiggle in Perl.

--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
----------
Subscribe to Microsoft's Security Bulletins:
http://www.microsoft.com/technet/security/bulletin/notify.asp


"Curtis Anderson" <ned...@hotmail.com> wrote in message
news:uuJ0mtkvCHA.1656@TK2MSFTNGP09...

Curtis Anderson

unread,
Jan 17, 2003, 1:10:19 PM1/17/03
to
Alex K. Angelopoulos (MVP) <a...@mvps.org> uttered:

> Yeah. I could do that with two punctuation marks and a squiggle in
> Perl.

I once wrote an entire database in Perl using nothing but squiggles.
;-p

Curtis


Joe Earnest

unread,
Jan 17, 2003, 3:53:48 PM1/17/03
to
Hi Guys,

As a far, far aside ...

But remember, the point of VBS language, like all
BASICs, is to be a general utility language, easily and
broadly recognizable. Users with even rudimentary
knowledge are supposed to be able to get an idea
of what is going on, and more knowledgable users
can learn from others' scripts. It's not supposed to
be a highly specialized and coded language. (It's not
even as specialized and coded as JScript.) Personally,
I don't even like like regexp (though it's obviously
necessary some of the time when it's applied),
because it runs against this grain.

Oh well, the daily ranting is over ...

Regards,
Joe Earnest

"Curtis Anderson" <ned...@hotmail.com> wrote in message

news:u3hvpOlvCHA.2596@TK2MSFTNGP12...

Alex K. Angelopoulos (MVP)

unread,
Jan 17, 2003, 3:58:50 PM1/17/03
to
Joe,
the correct response was " I could have done it with a punctuation mark and half
a squiggle." ;)


(By the way, you are absolutely correct. That isn't officially the point of the
language but it's pretty darned true anyway.)

"Joe Earnest" <joeea...@qwest.net> wrote in message
news:OH553nmvCHA.1644@TK2MSFTNGP12...

Curtis Anderson

unread,
Jan 17, 2003, 4:12:57 PM1/17/03
to
Joe Earnest <joeea...@qwest.net> uttered:

> As a far, far aside ...

We're already so far off topic we may as well be in a different NG.... :-)

Joe Earnest

unread,
Jan 17, 2003, 4:48:21 PM1/17/03
to
Hi Guys,

> We're already so far off topic we may as well be in a different NG.... :-)

Speaking of which ...

Has anyone seen a post from "name" lately.
I kinda miss his comet-like tours through
the newsgroup.

Regards,
Joe Earnest

Alex K. Angelopoulos (MVP)

unread,
Jan 17, 2003, 4:55:41 PM1/17/03
to
I think he's doing jscript these days. I check his posts in Google regularly; He
comes up with occasional Zenlike profundities.

If his English syntactic skills were better, he would always be a hilarious
poster - of course, then they would lose a certain bite. ;)

--
Please respond in the newsgroup so everyone may benefit.
http://dev.remotenetworktechnology.com
----------
Subscribe to Microsoft's Security Bulletins:
http://www.microsoft.com/technet/security/bulletin/notify.asp

"Joe Earnest" <joeea...@qwest.net> wrote in message

news:OahRYGnvCHA.1132@TK2MSFTNGP12...

Joe Earnest

unread,
Jan 17, 2003, 5:04:58 PM1/17/03
to
Hi Alex,

Thanks. I'll check on Google. ;-)

Regards,
Joe Earnest


Paul Randall

unread,
Jan 17, 2003, 8:34:27 PM1/17/03
to

"Joe Earnest" <joeea...@qwest.net> wrote in message news:OXknsPnvCHA.2796@TK2MSFTNGP12...

The scary thing is that sometimes I kind of understood what he was saying!

-Paul Randall


Michael Harris (MVP)

unread,
Jan 17, 2003, 8:41:51 PM1/17/03
to
> The scary thing is that sometimes I kind of understood what he was
> saying!

He does have his semi-coherent moments ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US


Rahul Verma

unread,
Jan 17, 2003, 10:00:00 PM1/17/03
to
Thatz correct VBS is supposed general propose language as started , but now
days it is becoming more and more complex for example creating a file you
have to write lengthy code
set fso=createobject("scripting.filesystemobject")
set file1=opentextfile("file1",1)
as opposed to sweet Perl
open(FD,"<file1")

isn'ted cool , but biggest disadvantage of using perl in Win32 platform ,
since it is not raidly avabile as on unix and consume lot of resource.

"Joe Earnest" <joeea...@qwest.net> wrote in message

news:OH553nmvCHA.1644@TK2MSFTNGP12...

Alex K. Angelopoulos (MVP)

unread,
Jan 17, 2003, 10:57:47 PM1/17/03
to
It depends on what your approach and needs are, I guess. In any case, your
problem was not VBScript: it was the Scripting.FileSystemObject model, which is
not always intuitive and doesn't wrap everything for easy use. If you used
WSH-hosted Perl (a possibility) you would have the exact same issues.

In my case, I've written several wrapper functions for FSO to make it dead easy
to read/write/append. Here's how I append data lines to a file. This is a
technique that completely wraps it up; this isn't "optimized", but it will work
adequately fast if you're not doing hundreds of thousands of line writes. The
best part is if you stick the procedure in your code library, it's a one-line
statement to append code.

AppendLine "C:\tmp\log.txt", "test"

Sub AppendLine(FilePath, sData)
'Given the path to a file, will append line sData to it
With CreateObject("Scripting.FileSystemObject")._
OpenTextFile(FilePath, 8, True, TristateUseDefault)
.WriteLine sData: .Close
End With
End Sub


"Rahul Verma" <raul...@hotmail.com> wrote in message

news:Qq3W9.573$e34...@nwrddc04.gnilink.net...

Joe Earnest

unread,
Jan 18, 2003, 9:57:11 AM1/18/03
to
Hi Rahul,

Ok. Yes, some languages are more self-contained and
less object-oriented. This was epitomized in pre-object-
oriented DOS days (or still exists in some aspects of
non-micro computing, specialized chips, etc.). In the
late 80's, MS decided to make object-orientation part
of the GUI-based operating system. The objects have
changed to greater or lesser degrees with the evolution
of Windows.

The advantages to object-orientation are that the language
is adaptive to OS/object changes and (importantly for a
non-compiled script) is lightweight and quick in operation.
Self-contained languages put more code between you
and the objects that they access. They are slower unless
compiled, and have greater difficulty in being compatible
across versions.

I agree that the syntax of many objects is obscure. But
the objects are designed for multiple-language access,
and the nuances are necessary to allow the object to be
used for different purposes. In some cases, I too, think
the object designers did a sloppy job. But object-
orientation is simply a fact of life today.

For what it's worth, even in DOS days, much of the
programming was being done in MASM or in a mix of
MASM and higher-level languages. The last versions of
QuickBASIC included the ability to effect MASM code
in compiled apps, and QuickBASIC was always capable
of importing MASM objects. MASM was necessary to
achieve some of the effects that object-orientation permits
(and more - like direct access to hardware). But *nothing*
is more obscure than strings of pure assembly language
command code bytes.

Joe Earnest

"Rahul Verma" <raul...@hotmail.com> wrote in message

news:Qq3W9.573$e34...@nwrddc04.gnilink.net...


| Thatz correct VBS is supposed general propose language as started , but
now
| days it is becoming more and more complex for example creating a file you
| have to write lengthy code
| set fso=createobject("scripting.filesystemobject")
| set file1=opentextfile("file1",1)
| as opposed to sweet Perl
| open(FD,"<file1")

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 10-31-02


name

unread,
Jan 19, 2003, 2:03:41 AM1/19/03
to
I was in year three programming. Beginning of 1989.

My neighbour bought an address book (mobile)

12KB memory, some hundreds of Dollars.

He cooked very good but was a little on the gay site.

I took him one look at my Visual Basic Programming Editor
and brand new Gateway < 100 MHz.
to say:

"Yes, but this is not case sensitive"


Trying to say, complaints about vbscript are either
masochistic or adhere to an veteranly MS world view.

I flew over the reponses to the thread and liked "semi-coherent moments"

----------------

To the post for "AVG anti-virus system".

yes I use it too and like it.

---
Y'all a nice wekend

"Rahul Verma" <raul...@hotmail.com> wrote in message

news:t_NV9.2703$IZ5....@nwrddc04.gnilink.net...

Alex K. Angelopoulos (MVP)

unread,
Jan 20, 2003, 6:57:18 AM1/20/03
to
"name" <ij...@tampabay.rr.com> wrote in message
news:#PCVbj4vCHA.2660@TK2MSFTNGP09...

> I was in year three programming. Beginning of 1989.
>

> Trying to say, complaints about vbscript are either


> masochistic or adhere to an veteranly MS world view.
>
> I flew over the reponses to the thread and liked "semi-coherent moments"
>
> ----------------
>
> To the post for "AVG anti-virus system".
>
> yes I use it too and like it.
>
> ---
> Y'all a nice wekend
>
>

Where ARE you from, name?

Your phrasing always has a hint of Asian elegance.

0 new messages