Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with WSCRIPT.SHELL 1

Status
Not open for further replies.

mdav2

Programmer
Aug 22, 2000
363
GB
The code below is what is run when the user chooses a help from the menu in bespoke system. It should open a HTML file whcih has all the help but it falls over with a when executing the create object line "oShell = CREATEOBJECT( 'WScript.Shell' )". They get a "Class definition WSCRIPT.SHELL is not found" error message.

I can't seem to find anything useful on this anywhere and no eaxamples seem to indicate any declarations or files that are required to run this object.

If I can't resolve this then I may have to resort to using the RUN command.

Code That Runs The Help
=======================
* Create a string hyperlink using the executable path and the help directory
cUrl= "'" + gcrootdir + 'Help\home.htm' + "'"

* Check that file exists
if file(&cUrl)=.t. then
* The file has been found

* Use the built in class for opening file (assumes html file association)
oShell = CREATEOBJECT( 'WScript.Shell' )

* Build a command line to be issued as the following two lines of syntax will not work
* oShell.Run(cUrl)
* oShell.Run('x:\develop\oap6\test\help\home.html')
cCommand="oshell.run(" + cUrl + ")"
&cCommand

* Remove the object you created
oShell = .NULL.
RELEASE oShell
else
* the file has not been found
messagebox("Unable to locate the helpfile, unable to display help",0+64,_screen.caption)
endif
 
mdav

'They get a "Class definition WSCRIPT.SHELL is not found" error message.'

That would indicate the WScript object is not installed on the user's machine.

Why not create a help file system using the free HTML Help rather than reinvent the wheel by calling individual .htm files in the way you are attempting?
FAQ184-2483 - the answer to getting answered.​

Chris [pc2]
 
DECLARE INTEGER ShellExecute IN shell32.dll ;
INTEGER hndWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin

cFileName = "'" + gcrootdir + 'Help\home.htm' + "'"
cAction = "open"
ShellExecute(0,cAction,cFileName,"","",1)

Attitude is Everything
 
Chris, I was unaware that a html help program was available and will look into using them in future (the help files had already been written by someone else, I was just asked to come up with a way of launching them from our system). Would you not still need to launch the single help file in some way from the VFP system? Or does the file run as a standard exe outside the system?

Danceman, I added the appropriate classes to my project. Used the code you provided and ran it from a menu. It did not error but didn't open the html document either.

Thanks to you both for the responses.
 
mdav

Suggest you start at :-


To link an HTML Help file to a VFP application, put :-

SET HELP TO path\filename.chm

in your main.prg.

There is also a forum, Microsoft: WinHelp and HTML Help authoring systems here at Tek-Tips.
FAQ184-2483 - the answer to getting answered.​

Chris [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top