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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execution of vbscript inside php

Status
Not open for further replies.

pirimor

Programmer
Apr 24, 2003
5
IT
Hi everyone,

I'm trying to execute a simple vbscript from php. It must convert a file '.doc' in a file '.htm' using Word.
It must work on server side.
It works if I execute it from command line with:
C:/cscript c:/script/doc_htm.vbs
but when I call it from php it doesn't work. The instruction that I use is:
exec("cscript c:/script/doc_htm.vbs");

The script is:

infile="D:\Word\index.doc"
outfile="D:\Word\word2"

Dim obj
Set obj = CreateObject("Word.Application")
obj.Visible = FALSE
obj.Documents.Open(infile)
obj.ActiveDocument.SaveAs outfile&"\index.htm", 8
obj.Quit

Could anyone help me?
Thank you.
 
why don't you use COM inside PHP to solve your problem without VBScript?

$word = new COM("word.application");
$word->Visible = 0;
$word->Documents->Open($infile);
$word->ActiveDocument->SaveAs (&outfile."\index.htm", 8);
$word->Quit();

You can see more information in


Anikin
Hugo Alexandre Dias
Web-Programmer
anikin@anikin-skywalker.com
 
I've tried using COM but it doesn't work.
It doesn't give me any error during execution, but it block the execution of the php script.
It blocks at the first istruction:

$word=new COM("word.application");

and I don't understand why.

Pietro
 
You have to use the COM extension in php.ini.

Find the line
extension=php_com.dll
and uncomment it



Anikin
Hugo Alexandre Dias
Web-Programmer
anikin@anikin-skywalker.com
 
I have no line like this in php.ini.
The PHP Manual says:

"...The windows version of PHP has built in support for this extension. You do not need to load any additional extension in order to use these functions."

I have installed php4.3.1 and it runs on apache2.0.4 on Win2K

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top