Well, first off, CTL+ALT+DEL and see if you have any zombie procs of MSword laying around and kill them. When i was developing an Excel COM program, the EXCEL.exe would hang around in memory and screw up the "legit" EXCEL process (beucase of issues with the COM implementation < 4.2.1)
Lines like this are just asking for trouble: > $word->Documents->Open->FileName[$wordDoc]->ConfirmConversions > [False]->ReadOnly[False]-> > AddToRecentFiles[False]->PasswordDocument[""]->PasswordTemplat > e[""]->Revert[False]->WritePasswordDocument[""]->WritePassword > Template[""]->Format["wdOpenFormatAuto"]; I know it's a pain, but try splitting that up into one-call-per-line, and then it'll be a pieced of cake to see where the error is. *always* check error messages and return status of calls. and upgrade to the newest version PHP (if not already running it). --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 > -----Original Message----- > From: R.S. Herhuth [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, May 21, 2002 2:29 PM > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] COM Problem > > > > I built a script that converts a Microsoft Word file to text > and removes > common characters. The text will then be stored in a > database for searching. > > The script below has been behaving a bit odd. It worked this morning > but now all I get back is a blank screen and the text file it > writes is > blank. This worked all day yeasterday and this morning but now it > stopped working. the script works fine if you manually save the Word > doc in the text format, but it wont write the text file. I built the > COM code by creating a Macro in Word and then analyzing it in > a VB editor. > > Can anyone see what the problem might be? It's driving me nuts. > > <?php > > // Filenames > $wordDoc = "BHresume.doc"; > $textDoc = "BHresume.txt"; > > // Perform Word Doc Conversion > $word=new COM("Word.Application") or die("There was a problem > launching > MS Word"); > > $word->visible = 1 ; > $word->Documents->Add(); > > // Open Word File > $word->Documents->Open->FileName[$wordDoc]->ConfirmConversions > [False]->ReadOnly[False]-> > AddToRecentFiles[False]->PasswordDocument[""]->PasswordTemplat > e[""]->Revert[False]->WritePasswordDocument[""]->WritePassword > Template[""]->Format["wdOpenFormatAuto"]; > > // Convert and save file as type=text > $word->ActiveDocument->SaveAs->FileName[$textDoc]->FileFormat[ > "wdFormatText"]->LockComments[False]->Password[""]->AddToRecen > tFiles[True]->WritePassword[""]->ReadOnlyRecommended[False]->E > mbedTrueTypeFonts[False]->SaveNativePictureFormat[False]->Save > FormsData[False]->SaveAsAOCELetter[False]; > > $word->Quit(); > > // Open the text doc > $fp = @fopen($textDoc,"ab+"); > > $fileText = fread($fp,8048); > fpassthru($fp); > > // Array of common words > $commonWords= array("*"," the "," with "," but"," of "," every "," at > "," by "," and "," as "," their "," not", " an "," if "," or > "," on "," > I "," in "," had "," on "," all "," a "," my "," > on "," up "," for "," each "," to "," etc "," that "," made "," > up","-",".",",",")","("); > > $finalString = $fileText; > > // Delete common words > for($i=0;$i<count($commonWords);$i++){ > $finalString = str_replace($commonWords[$i]," ", $finalString); > } > > // Print final string to screen > echo $finalString; > ?> > > > Thanks for any help! > Ron > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php