Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WSH 2.0 and VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
WSH 2.0 and VFP
Divers
Thread ID:
00368229
Message ID:
00368229
Vues:
59
I thought I would start to learn more about Windows Script Host. So I purchased the Dino Esposito book and went into learning about WSH. After a few pages I realized that there are 2 flavors of WSH WSH 1.0 and WSH 2.0 The book detailed what I needed for WSH 2.0 and I thought that I had the minimum requirements, but I was wrong.

So I am posting here for anyone who is interested some email I had with Ed and George concerning WSH issues and the book.

Here goes,hope you can follow it:

***FROM ME***
Hello Ed, George sent me to you for a little help. I purchased the WSH book by Esposito and downloaded and installed the WSH host files from MS web site and have the following question.

According to the book the examples files ending in .WS can now be just double clicked on in order to run them. Well there is no program associated with them even after I install the MS WSH files. The book tends to believe there should be. My question is this what do I associate to the .WS files in order to get them to run.

***FROM ED***
I've never seen a .WS extension, but I'd defer to Esposito on this; first and foremost, ensure that you have WSH version 2.0 installed - if you are not sure, go out to the MS Web site and download the current self-installing executable. WSH 1.0 did not support the .WS file extension or scriptlets. In fact, AFAIK, unless you've installed the scriptlet compiler, I don't think the .WS extension is supported by 2.0 either - .wsc, .wsf and .wsh are directly supported, as are the .js and .vbs extensions.

I checked the MSDN docs - what Esposito talks about as .ws files (remember he wrote the book early in the 2.0 beta) are actually implemented as .WSF files. THe following is cut from the April MSDN

Microsoft® Windows® Script Host
Using Windows Script Files WSH Tutorial
--------------------------------------------------------------------------------

The Windows script (.wsf) file, a text document containing Extensible Markup Language (XML) code, incorporates several features that offer you increased scripting flexibility. Because Windows script files are not engine-specific, they can contain script from any ActiveX®-compliant scripting engine.
With .wsf files, you can take advantage of the following benefits as you create your scripts:


Support for Include statements - allows you to incorporate previously-written functions from VBScript or JScript files into your Windows Script Host project.
Support for multiple engines - allows you to use more than one scripting language per file.
Support for Type libraries - allows you to add constants to your code.
Support for tools - allows you to edit files with any XML editor.
Support for multiple jobs in one file - allows you to store all of your code in a single location.
Include Statements
If you have .js and .vbs files from previous Windows Script Host projects, a .wsf file enables you to use them with Windows Script Host. A .wsf file encapsulates a library of functions that can in turn be used by multiple .wsf files.
The following example shows the contents of a .wsf file that includes a JScript file (fso.js), plus a VBScript function that calls a function (GetFreeSpace) in the included file. The contents of fso.js are provided also.


***FROM ME ***
Thanks Ed for the info, I will test out some of it later this morning.

***FROM Ed ***
I looked at Esposito's book, and what he describes as .WS files are implemented as .WSF files in WSH 2.0 currently.

You might want to get a subscription to Win32 Scripting Journal, from the peopel doing Windows 2000 Magazine - runs about $100/year, includes electronic access to the back issues. www.win32scripting.com

***FROM ME ***
It would be nice if Esposito had an updated CHM file for the book, that took care of some of the differences between the beta and the release.

Another question that George deffered to you was about the shell.application that Dino used in the book. According to Dino I have what I need to test this stuff out, but George thinks differently. I am using win95 and I.E. 5.0 and did install the WSH 2.0 from MS site. Do you have any opinion on the shell issue below. (Thanks for your time Ed I appreciate it)

***FROM ED ***
If you never installed IE4 and started from the retail Win95, Shell.Application is not present on your system. If your copy of Win95 shows as either Win95 or Win95a and you never put IE4 on, the shell components needed will not be on the system - AFAIK, the only way to add them to retail Win95 is to install IE4 at some point - the files are a part of IE4's Active Desktop support, which is not installed if you go straight to IE5.

OSR 2 had the required components, so if your system reports as Win95b or Win95c, you're OK. The component that provides the COM object is there for OSR2 and later releases, but other than IE4, there's no definite thing that contains the necessary .DLLs for the Shell support.

***FROM ME ***
We did install IE4 here, but I and several other chose not to have the active desktop part, just the browser. So now we are up to IE5, so I guess the post I saw on this means that the only way to get it is to unistall 5, then install 4 with the active desktop, then upgrade to 5. Unless you have a quicker method.


***FROM Ed
Not that's 100% reliable - the best alternatives are either doing the uninstall IE5/install IE4/reinstall IE5 shuffle, or to upgrade to Win98/Win98SE/Win2K, which would preserve whatever current configuration details through the upgrade.

In some cases, installing Win95 OSR2 v2.5 over the existing Win95 system works - you would need to re-apply any patches to Win95 that shipped after the 2.5 release date. It's likely that you'd need to reinstall IE5 IAC afterwards to make sure that the various support files for IE are behaving.

I think that installing O2K would add the files, but I'm not sure about that - I've required my clients to upgrade to at least OSR2 v 2.5 or Win98 as appropriate.


****THE END

Hope this helps someone in the future, but the bottom line is that you need to try things out in the book to ensure that there are no typos or beta carry overs. You also need to realize what is all required for WSH 2.0 to work. There seems to be alot of hoops to jump through (loads to check) if you are still working in Win 95 environment.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Répondre
Fil
Voir

Click here to load this message in the networking platform