Python and Windows Scripting Host

John Nielsen nielsenjf at my-deja.com
Wed Mar 1 18:50:22 EST 2000


If you're switching between languages even using WSH, things will change
because perl,python,vbscript do things a little bit differently.

WSH effectively reduces it to the lowest common denominator.
It doesn't seem as though you then gain much for that cost.

For example, here is vbscript to print out environment variables:


' VB Script
Set WShShell = WScript.CreateObject("WScript.Shell")

For Each strEnv In WShShell.Environment
WScript.Echo strEnv
Next

The equiv perl is (chosen because it looks most different):

$WScript->CreateObject("WScript.Shell");
foreach my $strEnv (Win32::OLE::in($WShShell->Environment)) {
 $WScript->Echo($strEnv);

I'd much rather just look at %ENV which is a powerful dictionary in perl
rather than this lowest common denominator thing.

When I last looked, WSH didn't have win32 access anyways. There's a
shell and network object, which offer you a few things. You still then
need to write a lot of your interesting code as com objects. Which may
be overkill for a simple script.

WSH really only helps vbscript and jscript.

Maybe there's something I am missing. But, it doesn't seem that python
has much to gain from WSH.

john



In article <C5A7720BDEB7D3118A5200E018C200A02012F6 at EXCHANGE>,
  Gaetan Corneau <corg at copernic.com> wrote:
> The idea is to be able to use any ActiveX Scripting compliant language
=
> in
> your application without change, and be able to use the same debugger
=
> for
> any language. For some applications, it's great.
> ______________________________________________________
>    Gaetan Corneau
>    Software Developer=20
>    Copernic Technologies inc.=20
>    http://www.copernic.com
>    E-mail: corg at copernic.com                        =20
> ______________________________________________________
> "Tu l'as trop =E9cras=E9, C=E9sar, ce Port Salut"
>
> > It's been a while since I looked at it, but I remember being
> > unimpressed. WSH looks to be more useful for more braindead =
> languages.
> > It may offer python a little bit in GUI capabilities.
> >=20
> > Python's win32 stuff is great, and it has a very python feel to it.
>
>

--
nielsenjf at my-Deja.com


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list