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


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

What should one read to learn VBScript?

Started byPeter Percival <peterxpercival@hotmail.com>
First post2018-01-17 12:55 +0000
Last post2018-01-20 13:53 -0500
Articles 20 on this page of 24 — 5 participants

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


Contents

  What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-17 12:55 +0000
    Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-17 10:25 -0500
      Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-17 21:50 -0500
      Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-17 22:49 -0500
      Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-18 12:42 +0000
      Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-19 21:28 +0000
        Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-19 21:59 +0000
          Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-19 18:06 -0500
            Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-20 14:15 +0000
        Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-19 17:06 -0500
          Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-20 14:20 +0000
            Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-20 09:40 -0500
        Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-19 17:20 -0500
          Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-19 17:52 -0500
      Re: What should one read to learn VBScript? Sohel Alam <alam.sohel1990@gmail.com> - 2018-05-14 17:19 -0700
    Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-17 22:44 -0500
      Re: What should one read to learn VBScript? Peter Percival <peterxpercival@hotmail.com> - 2018-01-18 12:40 +0000
      Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-18 09:27 -0500
        Re: What should one read to learn VBScript? Special Access <nonyabidnezz@hotmail.com> - 2018-01-18 21:57 -0500
        Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-19 20:53 -0500
          Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-19 23:20 -0500
            Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-20 10:33 -0500
              Re: What should one read to learn VBScript? Wally W. <ww84wa@aim.com> - 2018-01-20 10:44 -0500
              Re: What should one read to learn VBScript? "Mayayana" <mayayana@invalid.nospam> - 2018-01-20 13:53 -0500

Page 1 of 2  [1] 2  Next page →


#11788 — What should one read to learn VBScript?

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-17 12:55 +0000
SubjectWhat should one read to learn VBScript?
Message-ID<p3nh49$igo$1@news.albasani.net>
What should one read to learn VBScript?  I am new to VBScript but an 
experienced programmer.

[toc] | [next] | [standalone]


#11789

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-17 10:25 -0500
Message-ID<p3nptm$729$1@dont-email.me>
In reply to#11788
"Peter Percival" <peterxpercival@hotmail.com> wrote

| What should one read to learn VBScript?  I am new to VBScript but an
| experienced programmer.

  That's a big topic. In part it depends on what
you want to do. Are you aware that VBS is officially
"deprecated"? Microsoft is pushing PowerShell and
command line, to the extent they're pushing anything.

  VBS is extremely useful and flexible, nonetheless, and
the Windows Script Host that makes it usable is still
part of all Windows versions. I use it almost daily to
automate tasks.

  There's VBS and Windows Script Host (WSH). They overlap.
VBS can be used in IE for dynamic webpage scripting,
and in HTAs. The early VBS books were actually just Web
scripting books. But then MS added COM support
(ActiveX objects) and VBS became a general programming
tool. With WSH, circa Win98, they were introducing a
new replacement for BAT files to go with the GUI era.
(Ironically, PowerShell is a step backward to command line,
aimed at making Linux server admins feel at home on
Windows while "civilian" Windows users are discouraged
from trying to do anything handy.)

   The VBS language is relatively simple, but the tools are
vast. Connecting to any COM object brings a unique
set of available functions. docs for such things are not
part of VBS docs.

  I have a couple of Wrox books that are good. O'Reilly
books are generally OK. But the single most useful
thing to my mind is the help files. There's a file called
script56.chm. I don't know if you can still find it.
Microsoft have made a mess of Windows docs. Each
topic used to come with its own SDK: scripting,
AA, Windows Installer, etc. Now they're all packed
into one gigantic SDK, with help docs in HXS format.
HXS, in turn, requires a reader. They deliberately
broke CHM format with HXS. On the bright side, an
HXS can be converted to a CHM:

  ---------------------------------------------
Instructions for getting CHM files:
---------------------------------------------

Go here and download the win7 SDK:

https://www.microsoft.com/en-us/download/confirmation.aspx?id=18950

(Don't download the web installer nonsense. It should
be an ISO about 1.5 GB.)

Open the ISO in 7-Zip and take out the Setup folder.
In there, find these files and extract them from the CABs:

WinSDKDocWin32\cab2.cab -> WinSDK_script56....

   Reference for windows Script Host. It includes VBS
methods as well as documentation of common objects
like FileSystemObject.
   Note that FSO, WScript.Shell, etc are basic objects
that are considered to be part of WSH and are therefore
detailed in the help file. But any COM object offering a
dispatch/dual interface can be used by VBS. And you
can write those yourself.

WinSDKDocWin32\cab5.cab ->  WinSDK_shell...

  Reference for Shell.Application, which provides
access to various functions, including Explorer.
IE and Explorer are technically the same, left over
from Active Desktop. As a result, VBS can access
Explorer windows.

WinSDKDocWin32\cab5.cab -> WinSDK_DHTML...

  Full IE scripting reference. Last topic deals with
the entire IE DOM for webpage scripting.

  Then go here and download my converter utility.
(Written as an HTA using VBScript. :)
www.jsware.net/jsware/hxs2chm.php5

  There are instructions to convert the whole SDK
doc mess into CHMs. Or you can just extract the
relevant files (above), rename them to .hxs files,
then use the HTA to convert them one at a time.

   You *can* install the SDK if you want to, but it's
gigantic. Most of it probably won't be of interest.
And then you're stuck going through the SDK to
read the help files.

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

  I also have a webpage here:

www.jsware.net/jsware/scripts.php5

  There's some info, lots of samples that start out
simple, and numerous components that are free to
use.

  If you need more help you might want to come back
with specific details about what you're trying to do.


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


#11790

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-17 21:50 -0500
Message-ID<p3p21d$49j$1@dont-email.me>
In reply to#11789
"Mayayana" <mayayana@invalid.nospam> wrote

|  Then go here and download my converter utility.
| (Written as an HTA using VBScript. :)
| www.jsware.net/jsware/hxs2chm.php5
|

  An update about the HXS conversion utility:

  I tested it out today to make sure of the details
of where to get the SDK, etc. In the process I
found that at least one HXS in the Win7 SDK
was faulty and it happened to be the scripting
help file.

  It's the first I've seen of this. The index file inside
the HXS is faulty, with wrong data. I've just rewritten
the tools to deal with it. If anyone tried to convert
script56 and failed, try the new version.

  This is actually not so surprising. Micorosft have
an odd habit of just breaking stuff for no apparent
reason. I once had to rewrite my MSI unpacker
utilities when I came across a faulty MSI file from
MS themselves. They had managed to screw it
up in a way I hadn't foreseen as possible. :) 

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


#11792

FromWally W. <ww84wa@aim.com>
Date2018-01-17 22:49 -0500
Message-ID<v1606d1anf7oh6dl8k24scntdq7k3pl8gv@4ax.com>
In reply to#11789
On Wed, 17 Jan 2018 10:25:34 -0500, Mayayana wrote:

>"Peter Percival" <peterxpercival@hotmail.com> wrote
>
>| What should one read to learn VBScript?  I am new to VBScript but an
>| experienced programmer.
>
>  That's a big topic. In part it depends on what
>you want to do. Are you aware that VBS is officially
>"deprecated"? 

Boo!

Can't they stick with anything?

I have been saying for years that I am moving to Linux. Windows 10
looks like it is going to be the motivation to make it happen. My
experience with a Windows 10 machine that wants to hog my internet
connection for ginormous updates seems to be the last straw.


>Microsoft is pushing PowerShell and
>command line, to the extent they're pushing anything.
>
>  VBS is extremely useful and flexible, nonetheless, and
>the Windows Script Host that makes it usable is still
>part of all Windows versions. I use it almost daily to
>automate tasks.
>
>  There's VBS and Windows Script Host (WSH). They overlap.
>VBS can be used in IE for dynamic webpage scripting,
>and in HTAs. The early VBS books were actually just Web
>scripting books. But then MS added COM support
>(ActiveX objects) and VBS became a general programming
>tool. With WSH, circa Win98, they were introducing a
>new replacement for BAT files to go with the GUI era.
>(Ironically, PowerShell is a step backward to command line,
>aimed at making Linux server admins feel at home on
>Windows while "civilian" Windows users are discouraged
>from trying to do anything handy.)
>
>   The VBS language is relatively simple, but the tools are
>vast. Connecting to any COM object brings a unique
>set of available functions. docs for such things are not
>part of VBS docs.
>
>  I have a couple of Wrox books that are good. O'Reilly
>books are generally OK. But the single most useful
>thing to my mind is the help files. There's a file called
>script56.chm. I don't know if you can still find it.
>Microsoft have made a mess of Windows docs. Each
>topic used to come with its own SDK: scripting,
>AA, Windows Installer, etc. Now they're all packed
>into one gigantic SDK, with help docs in HXS format.
>HXS, in turn, requires a reader. They deliberately
>broke CHM format with HXS. On the bright side, an
>HXS can be converted to a CHM:
>
>  ---------------------------------------------
>Instructions for getting CHM files:
>---------------------------------------------
>
>Go here and download the win7 SDK:
>
>https://www.microsoft.com/en-us/download/confirmation.aspx?id=18950
>
>(Don't download the web installer nonsense. It should
>be an ISO about 1.5 GB.)
>
>Open the ISO in 7-Zip and take out the Setup folder.
>In there, find these files and extract them from the CABs:
>
>WinSDKDocWin32\cab2.cab -> WinSDK_script56....
>
>   Reference for windows Script Host. It includes VBS
>methods as well as documentation of common objects
>like FileSystemObject.
>   Note that FSO, WScript.Shell, etc are basic objects
>that are considered to be part of WSH and are therefore
>detailed in the help file. But any COM object offering a
>dispatch/dual interface can be used by VBS. And you
>can write those yourself.
>
>WinSDKDocWin32\cab5.cab ->  WinSDK_shell...
>
>  Reference for Shell.Application, which provides
>access to various functions, including Explorer.
>IE and Explorer are technically the same, left over
>from Active Desktop. As a result, VBS can access
>Explorer windows.
>
>WinSDKDocWin32\cab5.cab -> WinSDK_DHTML...
>
>  Full IE scripting reference. Last topic deals with
>the entire IE DOM for webpage scripting.
>
>  Then go here and download my converter utility.
>(Written as an HTA using VBScript. :)
>www.jsware.net/jsware/hxs2chm.php5
>
>  There are instructions to convert the whole SDK
>doc mess into CHMs. Or you can just extract the
>relevant files (above), rename them to .hxs files,
>then use the HTA to convert them one at a time.
>
>   You *can* install the SDK if you want to, but it's
>gigantic. Most of it probably won't be of interest.
>And then you're stuck going through the SDK to
>read the help files.
>
>-----------------------------------------------
>
>  I also have a webpage here:
>
>www.jsware.net/jsware/scripts.php5
>
>  There's some info, lots of samples that start out
>simple, and numerous components that are free to
>use.
>
>  If you need more help you might want to come back
>with specific details about what you're trying to do.
>
>

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


#11794

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-18 12:42 +0000
Message-ID<p3q4np$qoi$3@news.albasani.net>
In reply to#11789
Mayayana wrote:
> "Peter Percival" <peterxpercival@hotmail.com> wrote
> 
> | What should one read to learn VBScript?  I am new to VBScript but an
> | experienced programmer.
> 
>    That's a big topic. In part it depends on what
> you want to do. Are you aware that VBS is officially
> "deprecated"? Microsoft is pushing PowerShell and
> command line, to the extent they're pushing anything.
> 
>    VBS is extremely useful and flexible, nonetheless, and
> the Windows Script Host that makes it usable is still
> part of all Windows versions. I use it almost daily to
> automate tasks.

Thanks for the reply and the links below.  They are genuinely helpful!

> 
>    There's VBS and Windows Script Host (WSH). They overlap.
> VBS can be used in IE for dynamic webpage scripting,
> and in HTAs. The early VBS books were actually just Web
> scripting books. But then MS added COM support
> (ActiveX objects) and VBS became a general programming
> tool. With WSH, circa Win98, they were introducing a
> new replacement for BAT files to go with the GUI era.
> (Ironically, PowerShell is a step backward to command line,
> aimed at making Linux server admins feel at home on
> Windows while "civilian" Windows users are discouraged
> from trying to do anything handy.)
> 
>     The VBS language is relatively simple, but the tools are
> vast. Connecting to any COM object brings a unique
> set of available functions. docs for such things are not
> part of VBS docs.
> 
>    I have a couple of Wrox books that are good. O'Reilly
> books are generally OK. But the single most useful
> thing to my mind is the help files. There's a file called
> script56.chm. I don't know if you can still find it.
> Microsoft have made a mess of Windows docs. Each
> topic used to come with its own SDK: scripting,
> AA, Windows Installer, etc. Now they're all packed
> into one gigantic SDK, with help docs in HXS format.
> HXS, in turn, requires a reader. They deliberately
> broke CHM format with HXS. On the bright side, an
> HXS can be converted to a CHM:
> 
>    ---------------------------------------------
> Instructions for getting CHM files:
> ---------------------------------------------
> 
> Go here and download the win7 SDK:
> 
> https://www.microsoft.com/en-us/download/confirmation.aspx?id=18950
> 
> (Don't download the web installer nonsense. It should
> be an ISO about 1.5 GB.)
> 
> Open the ISO in 7-Zip and take out the Setup folder.
> In there, find these files and extract them from the CABs:
> 
> WinSDKDocWin32\cab2.cab -> WinSDK_script56....
> 
>     Reference for windows Script Host. It includes VBS
> methods as well as documentation of common objects
> like FileSystemObject.
>     Note that FSO, WScript.Shell, etc are basic objects
> that are considered to be part of WSH and are therefore
> detailed in the help file. But any COM object offering a
> dispatch/dual interface can be used by VBS. And you
> can write those yourself.
> 
> WinSDKDocWin32\cab5.cab ->  WinSDK_shell...
> 
>    Reference for Shell.Application, which provides
> access to various functions, including Explorer.
> IE and Explorer are technically the same, left over
> from Active Desktop. As a result, VBS can access
> Explorer windows.
> 
> WinSDKDocWin32\cab5.cab -> WinSDK_DHTML...
> 
>    Full IE scripting reference. Last topic deals with
> the entire IE DOM for webpage scripting.
> 
>    Then go here and download my converter utility.
> (Written as an HTA using VBScript. :)
> www.jsware.net/jsware/hxs2chm.php5
> 
>    There are instructions to convert the whole SDK
> doc mess into CHMs. Or you can just extract the
> relevant files (above), rename them to .hxs files,
> then use the HTA to convert them one at a time.
> 
>     You *can* install the SDK if you want to, but it's
> gigantic. Most of it probably won't be of interest.
> And then you're stuck going through the SDK to
> read the help files.
> 
> -----------------------------------------------
> 
>    I also have a webpage here:
> 
> www.jsware.net/jsware/scripts.php5
> 
>    There's some info, lots of samples that start out
> simple, and numerous components that are free to
> use.
> 
>    If you need more help you might want to come back
> with specific details about what you're trying to do.
> 
> 
> 

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


#11797

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-19 21:28 +0000
Message-ID<p3tntd$uhe$1@news.albasani.net>
In reply to#11789
Mayayana wrote:
> "Peter Percival" <peterxpercival@hotmail.com> wrote
> 
> | What should one read to learn VBScript?  I am new to VBScript but an
> | experienced programmer.
> 
>    That's a big topic. In part it depends on what
> you want to do. Are you aware that VBS is officially
> "deprecated"? Microsoft is pushing PowerShell and
> command line, to the extent they're pushing anything.

Then my question becomes -

What should one read to learn about PowerShell?  I am new to PowerShell 
but an experienced programmer.

"I am new to" means I hadn't even heard of it until you mentioned it!

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


#11798

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-19 21:59 +0000
Message-ID<p3tpne$qgu$1@news.albasani.net>
In reply to#11797
Peter Percival wrote:
> Mayayana wrote:
>> "Peter Percival" <peterxpercival@hotmail.com> wrote
>>
>> | What should one read to learn VBScript?  I am new to VBScript but an
>> | experienced programmer.
>>
>>    That's a big topic. In part it depends on what
>> you want to do. Are you aware that VBS is officially
>> "deprecated"? Microsoft is pushing PowerShell and
>> command line, to the extent they're pushing anything.
> 
> Then my question becomes -
> 
> What should one read to learn about PowerShell?  I am new to PowerShell 
> but an experienced programmer.
> 
> "I am new to" means I hadn't even heard of it until you mentioned it!

I've just come across

	Microsoft PowerShell, VBScript & JScript Bible
	by William R. Stanek, James O'Neill, Jeffrey Rosen

any thoughts?

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


#11802

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-19 18:06 -0500
Message-ID<p3ttlh$v3q$1@dont-email.me>
In reply to#11798
"Peter Percival" <peterxpercival@hotmail.com> wrote

| I've just come across
|
| Microsoft PowerShell, VBScript & JScript Bible
| by William R. Stanek, James O'Neill, Jeffrey Rosen
|
| any thoughts?

  You *still* haven't given any clue about what
you want it for. How can anyone advise you?

   For PS you might ask here, though it doesn't look
very busy:

  microsoft.public.windows.powershell

  I don't know that book. In my experience, pretty
much all books are for beginners and may be somewhat
helpful to get started, but then you just need reference.

  I have an aversion to "Bible" books. The Windows
Bible books were very expensive and almost useless
in my view. But that may not mean anything.

  Windows Script Host by Dino Esposito is pithy, but
not if you're just an admin. On the other hand, if
what you want is admin books that's mostly what
you'll find with scripting and PS because that's the
biggest market.

   I actually first learned about VBS from a book called
Windows 98 Annoyances. It was a wonderful tweaking
guide and near the end he explained the basics of VBS
and where it fit into Windows. At the time I had no
programming experience at all. I was fairly new to
computers. But the author, David Karp, introduced
me to the idea that I could control things from the
other side of the computer screen and I was hooked.


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


#11805

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-20 14:15 +0000
Message-ID<p3viu5$37a$1@news.albasani.net>
In reply to#11802
Mayayana wrote:
> "Peter Percival" <peterxpercival@hotmail.com> wrote
> 
> | I've just come across
> |
> | Microsoft PowerShell, VBScript & JScript Bible
> | by William R. Stanek, James O'Neill, Jeffrey Rosen
> |
> | any thoughts?
> 
>    You *still* haven't given any clue about what
> you want it for. 

Just-for-fun programming.  Firtling/furtling about under the hood, so to 
speak.  No doubt I can firtle/furtle to my heart's content using C, but 
my guess (note "guess") is that using a scripting language will be 
quicker.  And it will provide an opportunity to learn something new.

> How can anyone advise you?
> 
>     For PS you might ask here, though it doesn't look
> very busy:
> 
>    microsoft.public.windows.powershell
> 
>    I don't know that book. In my experience, pretty
> much all books are for beginners and may be somewhat
> helpful to get started, but then you just need reference.
> 
>    I have an aversion to "Bible" books. The Windows
> Bible books were very expensive and almost useless
> in my view. But that may not mean anything.
> 
>    Windows Script Host by Dino Esposito is pithy, but
> not if you're just an admin. On the other hand, if
> what you want is admin books that's mostly what
> you'll find with scripting and PS because that's the
> biggest market.
> 
>     I actually first learned about VBS from a book called
> Windows 98 Annoyances. It was a wonderful tweaking
> guide and near the end he explained the basics of VBS
> and where it fit into Windows. At the time I had no
> programming experience at all. I was fairly new to
> computers. But the author, David Karp, introduced
> me to the idea that I could control things from the
> other side of the computer screen and I was hooked.
> 
> 
> 

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


#11799

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-19 17:06 -0500
Message-ID<p3tq53$8g6$1@dont-email.me>
In reply to#11797
"Peter Percival" <peterxpercival@hotmail.com> wrote

| What should one read to learn about PowerShell?  I am new to PowerShell
| but an experienced programmer.
|

  Maybe someone else can answer that. Or there
may be a PS group. As far as I'm concerned, life's
too short for command line.

  PowerShell was designed to appeal to Linux people
who are used to working in console windows with
commands that are standalone applets. But in this
case the applets are actually .Net programs. So
.Net is a requisite.

   Imagine commandline Java. If that sounds
like fun then maybe you want Powershell. But
as a system of commandline applets it's really
all about learning the commands rather than
programming.

  Like WSH and WMI before it, PS is mainly aimed
at admins. WMI turned out to be a vast system
with very little value. WSH turned out to be a
high-level programming system due to COM
integration. PowerShell? It might be what you need,
but you never did say anything about what you
want to accomplish. If you want to get an admin
IT job then definitely you want PS. Otherwise?

  Here's an example that might give you an idea
of how it works. It's a discussion about searching for
a word in a number of files.

https://stackoverflow.com/questions/8153750/how-to-search-a-string-in-multiple-files-and-return-the-names-of-files-in-powers

  In VBScript that would be done in a way that's
vaguely similar to the API: Get a folder object.
Get the folder files as a collection. For Each
through the files, opening them, searching the
content as a string, creating a report to write
to disk or show as a message.... that kind of thing.

  In PS it's more like DOS with endless switches
and an unlimited possible number of commands.

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


#11806

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-20 14:20 +0000
Message-ID<p3vj6i$4bi$1@news.albasani.net>
In reply to#11799
Mayayana wrote:
> "Peter Percival" <peterxpercival@hotmail.com> wrote
> 
> | What should one read to learn about PowerShell?  I am new to PowerShell
> | but an experienced programmer.
> |
> 
>    Maybe someone else can answer that. Or there
> may be a PS group. As far as I'm concerned, life's
> too short for command line.
> 
>    PowerShell was designed to appeal to Linux people
> who are used to working in console windows with
> commands that are standalone applets. But in this
> case the applets are actually .Net programs. So
> .Net is a requisite.
> 
>     Imagine commandline Java. If that sounds
> like fun then maybe you want Powershell. But
> as a system of commandline applets it's really
> all about learning the commands rather than
> programming.
> 
>    Like WSH and WMI before it, PS is mainly aimed
> at admins. WMI turned out to be a vast system
> with very little value. WSH turned out to be a
> high-level programming system due to COM
> integration. PowerShell? It might be what you need,
> but you never did say anything about what you
> want to accomplish. If you want to get an admin
> IT job then definitely you want PS. Otherwise?
> 
>    Here's an example that might give you an idea
> of how it works. It's a discussion about searching for
> a word in a number of files.
> 
> https://stackoverflow.com/questions/8153750/how-to-search-a-string-in-multiple-files-and-return-the-names-of-files-in-powers

Thank you.  It so happens that one thing I want to write is a find 
utility that is better than the "Type here to search" box in the lower 
left-hand corner of my screen.  (Most anything is going to be better.) 
So that will be genuinely useful.
> 
>    In VBScript that would be done in a way that's
> vaguely similar to the API: Get a folder object.
> Get the folder files as a collection. For Each
> through the files, opening them, searching the
> content as a string, creating a report to write
> to disk or show as a message.... that kind of thing.
> 
>    In PS it's more like DOS with endless switches
> and an unlimited possible number of commands.
> 
> 

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


#11807

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-20 09:40 -0500
Message-ID<p3vkd8$5ip$1@dont-email.me>
In reply to#11806
"Peter Percival" <peterxpercival@hotmail.com> wrote

| > 
https://stackoverflow.com/questions/8153750/how-to-search-a-string-in-multiple-files-and-return-the-names-of-files-in-powers
|
| Thank you.  It so happens that one thing I want to write is a find
| utility that is better than the "Type here to search" box in the lower
| left-hand corner of my screen.  (Most anything is going to be better.)

  I should think so! Do you know Agent Ransack?
It might be worth a look. I haven't used Windows
search for years. And doesn't it call home now on
Win10?

  If you use C you can probably figure out the
landscape here for yourself. For what it's worth:

 * You might like javascript better than VBS, insofar
as it's designed to look like C/C++. It has almost
the same functionality in Windows Script Host (WSH).

 * WSH can also accomodate installing other languages,
in case you're one of those Perl weirdos. :)

 * PowerShell is vast. If you prefer commandline
you should be able to do what you like with that.

 * One big difference that's probably worth noting
is that the power of VBS/JS in WSH mainly comes from
COM. Just about any dispatch/dual interface can be
used. And GUI programs can be written with script
and HTML as an HTA. PS, by contrast, seems to
get its power from .Net, with the ability to access
the .Net object model. But I'm somewhat speculating
there. I really don't know much about PS.

* If you look at my scripts page, linked above, the
left side of the index is scripts and the right side
is components that can be used in script. What's
there is probably a good general listing of the kinds
of things you can do with WSH.

   I use it to make tools, like the HXStoCHM
converter, and to do little things. I have lots of
VBS scripts on my desktop, to clean up URLs,
fix returns in text files, decode base64, remove
read-only attributes, etc.

  An interesting example: Last night I wrote a script
to make a readable webpage from something I
downloaded.

  http://www.uceprotect.net/en/index.php?m=7&s=6

I went to the US Congress site to find out whether
any congresspeople I vote for had voted to extend
the FISA spying and warrantless wiretapping law.
(I'm amazed that a majority still support a probably
illegal law that was originally passed shortly after 9/11.)

  What I got was a page with limited info. But it turned
out that all of the info was actually in the source code.
There was a line for every house rep:

<recorded-vote><legislator name-id="A000374" sort-field="Abraham" 
unaccented-name="Abraham" party="R" state="LA" 
role="legislator">Abraham</legislator><vote>Yea</vote></recorded-vote>

  I realized it would be easy to write a script to parse
that mess and generate a webpage with a color-coded
listing by party and vote. I wrote the code below, added
the CSS at the top of the XML file, then dropped the XML
file onto the script to generate a readable webpage. That
script may stay on my desktop in case I want to read
future rollcall votes.

'----------------------------------------------
Dim FSO, TS, s1, s2, Arg, A1, i2, Q2

Q2 = Chr(34)
Arg = WScript.Arguments(0)
Set FSO = CreateObject("Scripting.FileSystemObject")

Set TS = FSO.OpenTextFile(Arg, 1)
  s1 = TS.ReadAll
  TS.Close
Set TS = Nothing

A1 = Split(s1, vbCrLf)
For i2 = 0 to UBound(A1)
  s2 = A1(i2)
  If Left(s2, 15) = "<recorded-vote>" Then
    ParseS2 s2
    A1(i2) = s2
  End If
Next

s1 = Join(A1, vbCrLf)
Set TS = FSO.CreateTextFile(Arg & "2", True)
  TS.Write s1
  TS.Close
Set TS = Nothing
Set FSO = Nothing


Sub ParseS2(sIn)
  Dim Pt1, Pt2, sName, sParty, sVote, sState

  Pt1 = InStr(sIn, "field=")
  Pt2 = InStr((Pt1 + 7), sIn, Q2)
  sName = Mid(sIn, Pt1 + 7, Pt2 - (Pt1 + 7))

  Pt1 = InStr(sIn, "party=")
  Pt2 = InStr((Pt1 + 7), sIn, Q2)
  sParty = Mid(sIn, Pt1 + 7, Pt2 - (Pt1 + 7))

 Pt1 = InStr(sIn, "state=")
  Pt2 = InStr((Pt1 + 7), sIn, Q2)
  sState = Mid(sIn, Pt1 + 7, Pt2 - (Pt1 + 7))

Pt1 = InStr(sIn, "<vote>")
  Pt2 = InStr((Pt1 + 6), sIn, Q2)
  sVote = Mid(sIn, Pt1 + 6, 1)

If sParty = "R" Then
   sIn = "<SPAN CLASS=" & Q2 & "TRed" & Q2 & ">" & sName & " (" & sState & 
") </SPAN>"
Else
  sIn = "<SPAN CLASS=" & Q2 & "TBlue" & Q2 & ">" & sName & " (" & sState & 
") </SPAN>"
End If
If sVote = "Y" Then
  sIn = sIn & "<SPAN CLASS=" & Q2 & "TBrown" & Q2 & ">&nbsp; &nbsp; Y 
</SPAN><BR>"
Else
  sIn = sIn & "<SPAN CLASS=" & Q2 & "TGreen" & Q2 & "> &nbsp; &nbsp; N 
</SPAN><BR>"
End If
End Sub

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


#11800

FromWally W. <ww84wa@aim.com>
Date2018-01-19 17:20 -0500
Message-ID<avq46d5kbd28hrh4aik0djqtr24gt91929@4ax.com>
In reply to#11797
On Fri, 19 Jan 2018 21:28:11 +0000, Peter Percival wrote:

>Mayayana wrote:
>> "Peter Percival" <peterxpercival@hotmail.com> wrote
>> 
>> | What should one read to learn VBScript?  I am new to VBScript but an
>> | experienced programmer.
>> 
>>    That's a big topic. In part it depends on what
>> you want to do. Are you aware that VBS is officially
>> "deprecated"? Microsoft is pushing PowerShell and
>> command line, to the extent they're pushing anything.
>
>Then my question becomes -
>
>What should one read to learn about PowerShell?  I am new to PowerShell 
>but an experienced programmer.
>
>"I am new to" means I hadn't even heard of it until you mentioned it!

Likewise.

And sysadmins want it that way.

Cross-platform is good, because it sounds like the scripts can be used
in Linux.

But Powershell looks like it sucks for things that need to be portable
in the Apple_control_freak--wannabe world of Windows:

https://www.pdq.com/blog/powershell-how-to-write-your-first-powershell-script/
Go ahead and try that command. You **should** [really?!!!] get an
error that says scripts have been disabled on your system.
...
This is normal behavior. [in the world of M$ and their drones]

There are 4 execution policies you can use:
Restricted – Scripts won’t run. Period. (Default setting)
...
In order to change the execution policy, we will need to reopen
PowerShell as an Administrator (the command will fail otherwise) 

IOW: Probably not a useful language unless one has admin rights on
what is still called (in newspeak), a **personal** computer.

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


#11801

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-19 17:52 -0500
Message-ID<p3tssc$q4s$1@dont-email.me>
In reply to#11800
"Wally W." <ww84wa@aim.com> wrote

| 
https://www.pdq.com/blog/powershell-how-to-write-your-first-powershell-script/
| Go ahead and try that command. You **should** [really?!!!] get an
| error that says scripts have been disabled on your system.
| ...
| This is normal behavior. [in the world of M$ and their drones]
|
   Interesting. I didn't know that. I mainly work on
XP and don't even have PS installed. It's optional
on XP and I see no reason to add the security risk. 

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


#11933

FromSohel Alam <alam.sohel1990@gmail.com>
Date2018-05-14 17:19 -0700
Message-ID<5e67c351-86bf-4558-9046-7a0989ebea74@googlegroups.com>
In reply to#11789
You are a mythical God of operating system.

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


#11791

FromWally W. <ww84wa@aim.com>
Date2018-01-17 22:44 -0500
Message-ID<mb506dljq7l3f6knt61r6k5a3n7gn6p4es@4ax.com>
In reply to#11788
On Wed, 17 Jan 2018 12:55:36 +0000, Peter Percival wrote:

>What should one read to learn VBScript?  I am new to VBScript but an 
>experienced programmer.

No recommendations on one thing to read, but it should be relatively
easy for an experienced programmer to pick up.

It is quite BASIC-ish, but needs to use object-oriented pieces to
reach into Windows for values.

I have come to be able to do things that are useful to me by starting
to build a BASIC-ish program and then ask Google when I need to access
a particular feature.

Or I search for programs that are close to what I want to do and tweak
them for my preferences.

I usually find what I need at msdn.microsoft.com or stackoverflow.com.

There are two flavors:
wscript (Windows GUI script)
cscript (console script)

I recommend starting with cscript because reacting to the error
reporting is less tedious.

This Google search seems to return some interesting possibilities for
places to start:   vbs tutorial cscript

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


#11793

FromPeter Percival <peterxpercival@hotmail.com>
Date2018-01-18 12:40 +0000
Message-ID<p3q4je$qoi$2@news.albasani.net>
In reply to#11791
Wally W. wrote:
> On Wed, 17 Jan 2018 12:55:36 +0000, Peter Percival wrote:
> 
>> What should one read to learn VBScript?  I am new to VBScript but an
>> experienced programmer.
> 
> No recommendations on one thing to read, but it should be relatively
> easy for an experienced programmer to pick up.
> 
> It is quite BASIC-ish, but needs to use object-oriented pieces to
> reach into Windows for values.
> 
> I have come to be able to do things that are useful to me by starting
> to build a BASIC-ish program and then ask Google when I need to access
> a particular feature.
> 
> Or I search for programs that are close to what I want to do and tweak
> them for my preferences.

That's my preferred plan of action!

> I usually find what I need at msdn.microsoft.com or stackoverflow.com.
> 
> There are two flavors:
> wscript (Windows GUI script)
> cscript (console script)
> 
> I recommend starting with cscript because reacting to the error
> reporting is less tedious.
> 
> This Google search seems to return some interesting possibilities for
> places to start:   vbs tutorial cscript
> 

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


#11795

From"Mayayana" <mayayana@invalid.nospam>
Date2018-01-18 09:27 -0500
Message-ID<p3qatb$b92$1@dont-email.me>
In reply to#11791
"Wally W." <ww84wa@aim.com> wrote

| I recommend starting with cscript because reacting to the error
| reporting is less tedious.
|

   Some people prefer command line, but you
sacrifice the complexity and convenience
of GUI by doing that. And of course you
lose the advantages of GUI itself, like HTAs.

   Just yesterday I was
updating my HXStoCHM utility to accomodate
MS bugs. I had a hard time with one part.
Putting a number of msgbox lines in the code
allowed me to track it down. I can't imagine how
I would have done that running command line.
It just would have meant typing out long
command lines instead of dropping one file
onto another.

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


#11796

FromSpecial Access <nonyabidnezz@hotmail.com>
Date2018-01-18 21:57 -0500
Message-ID<ijn26dp66nv8gn64p38uffhq3cv88ggo8f@4ax.com>
In reply to#11795
On Thu, 18 Jan 2018 09:27:48 -0500, "Mayayana"
<mayayana@invalid.nospam> wrote:

>"Wally W." <ww84wa@aim.com> wrote
>
>| I recommend starting with cscript because reacting to the error
>| reporting is less tedious.
>|
>
>   Some people prefer command line, but you
>sacrifice the complexity and convenience
>of GUI by doing that. And of course you
>lose the advantages of GUI itself, like HTAs.
>
>   Just yesterday I was
>updating my HXStoCHM utility to accomodate
>MS bugs. I had a hard time with one part.
>Putting a number of msgbox lines in the code
>allowed me to track it down. I can't imagine how
>I would have done that running command line.
>It just would have meant typing out long
>command lines instead of dropping one file
>onto another.
>

when I was working with VBS, I found this site:
http://www.vbsedit.com/

nice editor, even has a HTA editor as well.  Was relatively
inexpensive for "shareware" program.

Mike

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


#11803

FromWally W. <ww84wa@aim.com>
Date2018-01-19 20:53 -0500
Message-ID<6k756d1fprigiuf1afg9bvbo41ocm288ea@4ax.com>
In reply to#11795
On Thu, 18 Jan 2018 09:27:48 -0500, Mayayana wrote:

>"Wally W." <ww84wa@aim.com> wrote
>
>| I recommend starting with cscript because reacting to the error
>| reporting is less tedious.
>|
>
>   Some people prefer command line, but you
>sacrifice the complexity and convenience
>of GUI by doing that. And of course you
>lose the advantages of GUI itself, like HTAs.
>
>   Just yesterday I was
>updating my HXStoCHM utility to accomodate
>MS bugs. I had a hard time with one part.
>Putting a number of msgbox lines in the code
>allowed me to track it down. I can't imagine how
>I would have done that running command line.
>It just would have meant typing out long
>command lines instead of dropping one file
>onto another.

I often use wscript, but cscript can accept command line parameters.

I often run cscript via a batch file.

A batch file can also accept command line parameters, which may need
to be done via a shortcut.

So: It is possible to drop a file onto a batch file (or its shortcut)
to process an input file with cscript.

That way, there would be no need to respond on all the msgbox popups.

The text from wscript.echo statements (which behave as msgbox popups
in wscript) could be redirected to a text file.

Or the batch file can end with a PAUSE statement so the text doesn't
go away before you want it to.

So far, the sysadmins haven't taken away vbscript, but it's in their
must-piss-with-others DNA to do so eventually.

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


Page 1 of 2  [1] 2  Next page →

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


csiph-web